tags | uid | |||
---|---|---|---|---|
|
58ee12f7-54c8-4db0-9418-0b1e532355bb |
[!Warning] The docker-compose command is deprecated As of V2,
docker-compose
is now part of docker proper. Any commands should work simply by removing the dash (-
).However, as of Sep 2023, Docker on Synology still does not support the newer command format.
[!success] See here for help switching from snap to apt version Docker containers running, but not showing up in docker ps
- Compose
- Compose file - default:
compose.yaml
- Versions and upgrading
- Use secrets in Docker Compose
[!tip] Filename for Docker compose YAML config file The default path for a Compose file is
compose.yaml
(preferred) orcompose.yml
that is placed in the working directory. Compose also supportsdocker-compose.yaml
anddocker-compose.yml
for backwards compatibility of earlier versions. If both files exist, Compose prefers the canonicalcompose.yaml
.
- [[Run periodic speedtests and graph historic data|speedtest-tracker]]
- [[BookStack]]
- [[Docker on Ubuntu20 - Gatus|Gatus]]
- Data/changes are persistent by default, but will be lost when the container is rebuilt or updated
- For storing data that should persist across rebuilds, use volumes
- Images are built with Dockerfiles
- Environment variables precedence in Docker Compose
- Set environment variables in Compose (env files)
- Using
.env
files - How to setup environment variables in configuration
- [[this note will link to a heading in the long note#Define Environment Variables]]
[!bug] Don't try to edit vars after containers are built You can only set up variables during container creation (via
-e FOO=BAR
) It is not really feasible or recommended to change them after.
To paste a compose file in from Terminal
cat <<'EOF' >compose.yml
(...YAML...)
EOF
- Dockerfile reference
- Difference between COPY and ADD in a Dockerfile (TL;DR: use
COPY
)
[!tip] Default location for Volumes (aka Root Dir) On default Docker installs (Linux) Named Volumes are typically stored at
/var/lib/docker/volumes
. On Synology however, you'll find them at/volume1/@docker/volumes
. Bind mounts on the other hand can be placed anywhere.To programmatically determine the root dir, you can execute
docker info -f "{{.DockerRootDir}}/volumes"
[!example] Auto-creation of BIND mounts Recent versions of docker-compose support automatic creation of missing paths, by specifying the following directives in the compose file:
volumes: - type: bind source: /volume1/docker/foo target: /data bind: create_host_path: trueN.B.—this doesn't currently seem to work on Synology!
docker inspect -f '{{ json .Mounts }}' name | jq
docker inspect -f '{{ .Mounts }}' name
docker inspect <name> | jq -r '.[].Mounts[].Source'
docker inspect foo | jq -r 'map(.Mounts[] | [.Type, .Source] )[] | @tsv'
docker container ls -q | while read id; do docker inspect $id | jq -r '.[].Mounts[].Source'; done
docker container ls -q | while read id; do docker inspect $id -f '{{ .Mounts }}'; done
docker volume ls ...
docker volume ls --format "{{.Name}} {{.Mountpoint}}"
docker ps -aq
docker ps -a --format '{{ .ID }}'
docker inspect -f '{{.State.Status}}' foo1
journalctl -xu docker.service
docker logs -f container-name
docker events --filter name=container
docker run -it pairdrop sh
/usr/local/bin/docker-entrypoint.sh
[!question] on Synology, Docker Compose configs are called "Projects"
[!warning] Updating docker-compose binary Synology comes with an outdated version of
docker-compose
. You can download the latest from here and then copy it to/usr/local/bin
(find your architecture withuname -m
)
# /usr/local/bin/docker-compose version
Docker Compose version v2.9.0-6413-g38f6acd
# docker-compose version
Docker Compose version v2.9.0-6413-g38f6acd
# ./docker-compose-linux-x86_64 version
Docker Compose version v2.21.0
![[IMG-20230831100452447.png|500]]
![[IMG-20230831100452601.png|500]]
![[IMG-20230831100452648.png|500]]
![[IMG-20230831100452734.png|500]]
![[IMG-20230831100452823.png|500]]
![[IMG-20230831100452894.png|500]]
![[IMG-20230831100435117.png|300]]
![[IMG-20230831100452948.png|500]]
![[IMG-20230831100453007.png|500]]
Video
header_linking.mp4