Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| lwc:docker [2022/11/04 14:41] – John Harrison | lwc:docker [2026/03/01 10:34] (current) – John Harrison | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Workflow ===== | ||
| + | < | ||
| + | # First time setup: | ||
| + | docker-compose build # Builds your custom image from Dockerfile | ||
| + | docker-compose up -d # Starts containers using your custom image | ||
| + | |||
| + | # If you change the Dockerfile later: | ||
| + | docker-compose build # Rebuild the image | ||
| + | docker-compose up -d # Recreate containers with new image | ||
| + | |||
| + | # Or do both at once: | ||
| + | docker-compose up -d --build | ||
| + | </ | ||
| + | |||
| + | ===== File Operations ===== | ||
| * copy files to docker container: '' | * copy files to docker container: '' | ||
| * copy files from docker container: '' | * copy files from docker container: '' | ||
| * prune unneeded files (save disk space): '' | * prune unneeded files (save disk space): '' | ||
| + | |||
| + | ===== Docker Maintenance ===== | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * | ||
| + | |||
| + | ===== Housekeeping ===== | ||
| + | * When removing a service use '' | ||
| + | * The '' | ||
| + | * When updating images, after pulling and restarting, run '' | ||
| + | * '' | ||
| + | * | ||
| + | ==== Watchtower ==== | ||
| + | * Watchtower is a container which auto updates Docker containers | ||
| + | * It will only update containers with updates that have the same tag | ||
| + | * to always get the latest version use the tag '' | ||
| + | * you can check which images have which tags with '' | ||
| + | * some images might have '' | ||
| + | * check the logs: '' | ||
| + | * if you want Watchtower to skip trying to update an image add to '' | ||
| + | < | ||
| + | | ||
| + | db: | ||
| + | # label the image as each image gets its own label | ||
| + | image: mariadb: | ||
| + | labels: | ||
| + | - " | ||
| + | </ | ||
| + | * run watchtower immediately: | ||
| + | |||
| + | ===== Basic Operations ===== | ||
| + | * '' | ||
| + | * use the '' | ||
| + | * use the '' | ||
| + | * user the '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ===== Docker Registry ===== | ||
| + | * Docker Hub is the default registry and it is the biggest public registry | ||
| + | * you can store a private or public registry on Docker Hub | ||
| + | * Each application gets its on repo in the registry | ||
| + | |||
| + | ===== creating a Dockerfile ===== | ||
| + | * All dockerfiles start with a parent image or "base image" | ||
| + | * define the base image with '' | ||
| + | * copy files into the container: '' | ||
| + | * example: '' | ||
| + | * set the working directory: '' | ||
| + | * example: '' | ||
| + | * next come the dependencies: | ||
| + | * example: '' | ||
| + | * for the last command in the docker file i.e. start the process: '' | ||
| + | * example: '' | ||
| + | |||