update
This commit is contained in:
parent
63a22b149e
commit
82a376818e
32
README.md
32
README.md
|
@ -28,35 +28,37 @@ It's described in most details.
|
|||
|
||||
### Compose and environment variables
|
||||
|
||||
When making changes use `docker-compose down`, not just restart or stop.
|
||||
When making changes use `docker-compose down` and `docker-compose up -d`,
|
||||
not just restart or stop/start.
|
||||
|
||||
You **do not** need to fuck with `docker-compose.yml` to get something up,
|
||||
* You **do not** need to fuck with `docker-compose.yml` to get something up,
|
||||
simple copy paste should suffice.
|
||||
|
||||
You **do** need to fuck with `.env` file, that's where all the variables are.
|
||||
* You **do** need to fuck with `.env` file, that's where all the variables are.
|
||||
|
||||
Sometimes the `.env` file is used as `env_file`
|
||||
Often the `.env` file is used as `env_file`
|
||||
|
||||
* `.env` - actual name of a file, used only by compose.</br>
|
||||
`env_file: .env`
|
||||
|
||||
* `.env` - actual name of a file that is used only by compose.</br>
|
||||
It is used automatically just by being in the directory
|
||||
with the `docker-compose.yml`</br>
|
||||
Variables set there are available during the building of the container,
|
||||
but unless named in the `enviroment:` option they are not available
|
||||
but unless named in the `environment:` option they are not available
|
||||
in the running containers.
|
||||
* `env_file` - an option in compose that defines an existing external file.</br>
|
||||
Variables in this file will be available in the running container,
|
||||
but not during building of the container.
|
||||
|
||||
So to not have polluted huge ass compose file, or to not have multiple places
|
||||
where changes need to be made when adding a variable... `env_file: .env` BAM.
|
||||
Benefit is that you do not need to make changes at multiple places,
|
||||
adding variable or changing its name in `.env` does not require
|
||||
to also go in to compose to add/change it there..</br>
|
||||
Also the compose file looks less cramped.
|
||||
|
||||
Only issue is that all variables from `.env` are available in
|
||||
containers that use this.</br>
|
||||
That can lead to potential conflicts and clashes, looking at you nextcloud.
|
||||
|
||||
In those cases variables names are declared per container.
|
||||
|
||||
But `env_file: .env` is just easier, prettier... and mostly painless.
|
||||
Only issue is that **all** variables from `.env` are available in
|
||||
containers that use this method.</br>
|
||||
That can lead to potential issues if you try to use this approach elsewhere,
|
||||
universally.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -72,14 +72,14 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
`.env`
|
||||
```bash
|
||||
# GENERAL
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
TZ=Europe/Bratislava
|
||||
|
||||
# BITWARDEN
|
||||
|
|
|
@ -76,14 +76,14 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
`.env`
|
||||
```bash
|
||||
# GENERAL
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
TZ=Europe/Bratislava
|
||||
|
||||
#LINUXSERVER.IO
|
||||
|
|
|
@ -101,7 +101,7 @@ You want to change `example.com` to your domain.
|
|||
`.env`
|
||||
```bash
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
```
|
||||
|
||||
Domain names, api keys, email settings, ip addresses, database credentials, ...
|
||||
|
@ -147,7 +147,7 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
* port 80 and 443 are mapped for http and https
|
||||
|
@ -214,7 +214,7 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
`nginx-compose.yml`
|
||||
|
@ -230,7 +230,7 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
### - editing hosts file
|
||||
|
||||
|
@ -355,7 +355,7 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
With this setup, and assuming docker host at: `192.168.1.222`,
|
||||
|
@ -538,7 +538,7 @@ Add `CLOUDFLARE_API_TOKEN` variable with the value of the newly created token.
|
|||
`.env`
|
||||
```
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
|
||||
CLOUDFLARE_API_TOKEN=asdasdasdasdasasdasdasdasdas
|
||||
```
|
||||
|
@ -572,7 +572,7 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -55,14 +55,14 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
`.env`
|
||||
```bash
|
||||
# GENERAL
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
TZ=Europe/Bratislava
|
||||
```
|
||||
|
||||
|
|
|
@ -123,14 +123,14 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
`.env`
|
||||
```bash
|
||||
# GENERAL
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
TZ=Europe/Bratislava
|
||||
|
||||
# NEXTCLOUD-MARIADB
|
||||
|
|
|
@ -58,14 +58,14 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
`.env`
|
||||
```bash
|
||||
# GENERAL
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
TZ=Europe/Bratislava
|
||||
```
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ services:
|
|||
networks:
|
||||
default:
|
||||
external:
|
||||
name: $DEFAULT_NETWORK
|
||||
name: $DOCKER_MY_NETWORK
|
||||
```
|
||||
|
||||
`.env`
|
||||
|
@ -192,7 +192,7 @@ networks:
|
|||
```bash
|
||||
# GENERAL
|
||||
MY_DOMAIN=example.com
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
DOCKER_MY_NETWORK=caddy_net
|
||||
TZ=Europe/Bratislava
|
||||
|
||||
# GRAFANA
|
||||
|
|
|
@ -59,7 +59,6 @@ services:
|
|||
`.env`
|
||||
```bash
|
||||
# GENERAL
|
||||
DEFAULT_NETWORK=caddy_net
|
||||
|
||||
# WATCHTOWER
|
||||
WATCHTOWER_SCHEDULE=0 0 0 * * SAT
|
||||
|
|
Loading…
Reference in New Issue