linux:docker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:docker [2023/05/23 21:48] – Wulf Rajek | linux:docker [2025/04/16 23:45] (current) – Wulf Rajek | ||
---|---|---|---|
Line 3: | Line 3: | ||
https:// | https:// | ||
- | Copying files from/ | + | ===== Main install ===== |
+ | < | ||
+ | apt-get -y install curl unzip dialog | ||
+ | curl -fSSL get.docker.com | sh | ||
+ | </ | ||
+ | |||
+ | ===== Show logs ===== | ||
+ | |||
+ | < | ||
+ | docker logs --follow < | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Build image ===== | ||
+ | |||
+ | To build the docker image based on a Dockerfile in the current directory, use: | ||
+ | < | ||
+ | docker build . | ||
+ | </ | ||
+ | |||
+ | ===== Update container ===== | ||
+ | |||
+ | Update docker container to latest version via docker compose: | ||
+ | < | ||
+ | #Single container: | ||
+ | docker compose pull calibre-web | ||
+ | docker compose up -d calibre-web | ||
+ | docker image prune | ||
+ | |||
+ | #Update all containers: | ||
+ | docker compose pull | ||
+ | docker compose up -d | ||
+ | docker image prune | ||
+ | </ | ||
+ | |||
+ | ===== Health Checks ===== | ||
+ | |||
+ | Docker compose health checks: | ||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | ===== Copying files to/from containers ===== | ||
+ | |||
+ | Copying files from/ | ||
< | < | ||
docker cp dockerimage:/ | docker cp dockerimage:/ | ||
Line 9: | Line 52: | ||
</ | </ | ||
+ | ===== Flatten docker image layers ===== | ||
+ | Flatten docker image layers: | ||
+ | < | ||
+ | FROM yourbuildimage as build | ||
+ | # your existing build steps here | ||
+ | FROM scratch | ||
+ | COPY --from=build / / | ||
+ | CMD ["/ | ||
+ | </ | ||
+ | |||
+ | ===== Change mount points of containers ===== | ||
Change mount points of existing docker containers; | Change mount points of existing docker containers; | ||
Line 43: | Line 97: | ||
- Start the container if necessary: < | - Start the container if necessary: < | ||
+ | |||
+ | ===== PHP& | ||
+ | |||
+ | Containerised PHP & NGINX on Alpine, image size ~60MB: | ||
+ | https:// | ||
+ | https:// | ||
+ | |||
+ | Log nginx to stdout in Dockerfile: | ||
+ | < | ||
+ | # forward request and error logs to docker log collector | ||
+ | RUN ln -sf /dev/stdout / | ||
+ | && ln -sf /dev/stderr / | ||
+ | </ | ||
+ | |||
+ | ===== Rename/ | ||
+ | |||
+ | < | ||
+ | docker tag current/ | ||
+ | </ | ||
+ | |||
+ | ===== cmd shell of container ===== | ||
+ | < | ||
+ | docker exec -it < | ||
+ | docker exec -it < | ||
+ | </ | ||
+ | |||
+ | ===== GPU hardware acceleration ===== | ||
+ | |||
+ | Make sure the relevant GPU drivers are installed on the base system, then pass through the device via docker compose. | ||
+ | Check devices are available, there should be a device per GPU starting at renderD128 for the first GPU: | ||
+ | < | ||
+ | ls -la /dev/dri | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | devices: | ||
+ | - / | ||
+ | </ | ||
+ | |||
+ | ===== docker ps short ===== | ||
+ | Short form of docker ps to only get the container names: | ||
+ | < | ||
+ | docker ps | sed ' | ||
+ | </ | ||
+ | |||
+ | ===== docker running out of network addresses ===== | ||
+ | |||
+ | Error response from daemon: all predefined address pools have been fully subnetted | ||
+ | |||
+ | <code json / | ||
+ | { | ||
+ | " | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | {" | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | < | ||
+ | docker restart | ||
+ | docker network prune | ||
+ | </ | ||
linux/docker.1684874900.txt.gz · Last modified: 2023/05/29 11:53 (external edit)