You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -61,29 +61,42 @@ YOURLS is a set of PHP scripts that will allow you to run Your Own URL Shortener
61
61
62
62
## Start a `yourls` server instance
63
63
64
-
```console
65
-
$ docker run --name some-yourls --link some-mysql:mysql \
66
-
-e YOURLS_SITE="https://example.com" \
67
-
-e YOURLS_USER="example_username" \
68
-
-e YOURLS_PASS="example_password" \
69
-
-d yourls
64
+
```bash
65
+
docker run \
66
+
--name some-yourls \
67
+
--detach \
68
+
--network some-network \
69
+
--env YOURLS_SITE="https://example.com" \
70
+
--env YOURLS_USER="example_username" \
71
+
--env YOURLS_PASS="example_password" \
72
+
yourls
70
73
```
71
74
72
75
The YOURLS instance accepts a number of environment variables for configuration, see *Environment Variables* section below.
73
76
74
-
If you'd like to use an external database instead of a linked `mysql` container, specify the hostname and port with `YOURLS_DB_HOST` along with the password in `YOURLS_DB_PASS` and the username in `YOURLS_DB_USER` (if it is something other than `root`):
77
+
If you'd like to use an external database instead of a `mysql` container, specify the hostname and port with `YOURLS_DB_HOST` along with the password in `YOURLS_DB_PASS` and the username in `YOURLS_DB_USER` (if it is something other than `root`):
75
78
76
-
```console
77
-
$ docker run --name some-yourlss -e YOURLS_DB_HOST=10.1.2.3:3306 \
Then, access it via `http://localhost:8080/admin/` or `http://<host-ip>:8080/admin/` in a browser.
@@ -92,7 +105,7 @@ Then, access it via `http://localhost:8080/admin/` or `http://<host-ip>:8080/adm
92
105
93
106
## Environment Variables
94
107
95
-
When you start the `yourls` image, you can adjust the configuration of the YOURLS instance by passing one or more environment variables on the `docker run` commandline.
108
+
When you start the `yourls` image, you can adjust the configuration of the YOURLS instance by passing one or more environment variables on the `docker run` command-line.
96
109
The YOURLS instance accepts [a number of environment variables for configuration](https://yourls.org/docs/guide/essentials/configuration).
97
110
A few notable/important examples for using this Docker image include the following.
98
111
@@ -137,8 +150,12 @@ Database tables prefix, defaults to `yourls_`. Only set this when you need to ov
137
150
138
151
As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in `/run/secrets/<secret_name>` files. For example:
139
152
140
-
```console
141
-
$ docker run --name some-yourls -e YOURLS_DB_PASS_FILE=/run/secrets/mysql-root ... -d yourls:tag
Currently, this is supported for `YOURLS_DB_HOST`, `YOURLS_DB_USER`, `YOURLS_DB_PASS`, `YOURLS_DB_NAME`, `YOURLS_DB_PREFIX`, `YOURLS_SITE`, `YOURLS_USER`, and `YOURLS_PASS`.
@@ -148,38 +165,47 @@ Currently, this is supported for `YOURLS_DB_HOST`, `YOURLS_DB_USER`, `YOURLS_DB_
148
165
Example `compose.yaml` for `yourls`:
149
166
150
167
```yaml
168
+
name: yourls
151
169
services:
152
-
153
170
yourls:
154
171
image: yourls
155
172
restart: always
173
+
depends_on:
174
+
- mysql
156
175
ports:
157
-
- 8080:80
176
+
- 8080:8080
158
177
environment:
159
178
YOURLS_DB_PASS: example
160
179
YOURLS_SITE: https://example.com
161
180
YOURLS_USER: example_username
162
181
YOURLS_PASS: example_password
163
-
164
182
mysql:
165
183
image: mysql
166
184
restart: always
167
185
environment:
168
186
MYSQL_ROOT_PASSWORD: example
169
187
MYSQL_DATABASE: yourls
188
+
volumes:
189
+
- db:/var/lib/mysql
170
190
```
171
191
172
-
Run `docker compose up`, wait for it to initialize completely, and visit `http://localhost:8080/admin/` or `http://<host-ip>:8080/admin/` (as appropriate).
192
+
Run `docker compose up`, wait for it to initialize completely, and visit `http://localhost:8080/admin/`, or `http://<host-ip>:8080/admin/` (as appropriate).
173
193
174
194
## Adding additional libraries / extensions
175
195
176
196
This image does not provide any additional PHP extensions or other libraries, even if they are required by popular plugins. There are an infinite number of possible plugins, and they potentially require any extension PHP supports. Including every PHP extension that exists would dramatically increase the image size.
177
197
178
198
If you need additional PHP extensions, you'll need to create your own image `FROM` this one. The [documentation of the `php` image](https://github.com/docker-library/docs/blob/master/php/README.md#how-to-install-more-php-extensions) explains how to compile additional extensions.
179
199
180
-
The following Docker Hub features can help with the task of keeping your dependent images up-to-date:
200
+
## Include persistent user-content
201
+
202
+
Mount the volume containing your plugins, pages or languages to the proper directory; and then apply them through the "admin" UI. Ensure read/write/execute permissions are in place for the user:
203
+
204
+
- Plugins go in a subdirectory in `/var/www/html/user/plugins/`
205
+
- Pages go in a subdirectory in `/var/www/html/user/pages/`
206
+
- Languages go in a subdirectory in `/var/www/html/user/languages/`
181
207
182
-
- [Automated Builds](https://docs.docker.com/docker-hub/builds/) let Docker Hub automatically build your Dockerfile each time you push changes to it.
208
+
If you wish to provide additional content in an image for deploying in multiple installations, place it in the same directories under `/usr/src/yourls/` instead (which gets copied to `/var/www/html/` on the container's initial startup).
0 commit comments