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
The YOURLS instance accepts [a number of environment variables for configuration](https://yourls.org/#Config).
20
-
A few notable/important examples for using this Docker image include:
21
+
The YOURLS instance accepts a number of environment variables for configuration, see *Environment Variables* section below.
21
22
22
-
-`-e YOURLS_DB_HOST=...` (defaults to the IP and port of the linked `mysql` container)
23
-
-`-e YOURLS_DB_USER=...` (defaults to "root")
24
-
-`-e YOURLS_DB_PASS=...` (defaults to the value of the `MYSQL_ROOT_PASSWORD` environment variable from the linked `mysql` container)
25
-
-`-e YOURLS_DB_NAME=...` (defaults to "yourls")
26
-
-`-e YOURLS_DB_PREFIX=...` (defaults to "yourls_", only set this when you need to override the default table prefix)
27
-
-`-e YOURLS_COOKIEKEY=...` (default to unique random SHA1s)
28
-
-`-e YOURLS_SITE=...` (yourls instance url)
29
-
-`-e YOURLS_USER=...` (yourls instance user name)
30
-
-`-e YOURLS_PASS=...` (yourls instance user password)
23
+
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`):
31
24
32
-
If the `YOURLS_DB_NAME` specified does not already exist on the given MySQL server, it will be created automatically upon startup of the `yourls` container, provided that the `YOURLS_DB_USER` specified has the necessary permissions to create it.
25
+
```console
26
+
$ docker run --name some-%%REPO%%s -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.
38
+
Then, access it via `http://localhost:8080/admin/` or `http://<host-ip>:8080/admin/` in a browser.
41
39
42
-
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`):
40
+
**Note:** On first instantiation, reaching the root folder will generate an error. Access the YOURLS administration interface via the path `/admin/`.
41
+
42
+
## Environment Variables
43
+
44
+
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.
45
+
The YOURLS instance accepts [a number of environment variables for configuration](https://yourls.org/#Config).
46
+
A few notable/important examples for using this Docker image include the following.
47
+
48
+
### `YOURLS_SITE`
49
+
50
+
**Required.**
51
+
YOURLS instance URL, no trailing slash, lowercase.
Host, user (defaults to "root") and password for the database.
74
+
75
+
### `YOURLS_DB_NAME`
76
+
77
+
**Optional.**
78
+
Database name, defaults to "yourls". The database must have been created before installing YOURLS.
79
+
80
+
### `YOURLS_DB_PREFIX`
81
+
82
+
**Optional.**
83
+
Database tables prefix, defaults to "yourls_". Only set this when you need to override the default table prefix.
84
+
85
+
## Docker Secrets
86
+
87
+
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:
43
88
44
89
```console
45
-
$ docker run --name some-%%REPO%%s -e YOURLS_DB_HOST=10.1.2.3:3306 \
$ docker run --name some-%%REPO%% -e YOURLS_DB_PASS_FILE=/run/secrets/mysql-root ... -d %%IMAGE%%:tag
47
91
```
48
92
93
+
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`.
94
+
49
95
## %%STACK%%
50
96
51
-
Run `docker stack deploy -c stack.yml %%REPO%%` (or `docker-compose -f stack.yml up`), wait for it to initialize completely, and visit `http://swarm-ip:8080/admin/`, `http://localhost:8080/admin/`, or `http://host-ip:8080/admin/` (as appropriate).
97
+
Run `docker stack deploy -c stack.yml %%REPO%%` (or `docker-compose -f stack.yml up`), wait for it to initialize completely, and visit `http://swarm-ip:8080/admin/`, `http://localhost:8080/admin/`, or `http://<host-ip>:8080/admin/` (as appropriate).
0 commit comments