- To clean everything you have done during this TP, use:
docker system prune [options]
It is used to wipe out all unused containers, images, networks and volumes when you add the option --volumes
.
By default, it will not delete running containers or used images.
You can check the documentation for docker system prune
command.
HEALTHCHECK
USER
.dockerignore
- multi layer images: We can create lighter images using temporary images for compiling binary files:
# image for compiling the file FROM golang:1.13.4 AS builder # ... RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . # lighter image for running the app FROM scratch COPY --from=builder app . # ....
As a container is only a file system with metadatas, you can easily export and reimport your containers as a .tar archive.
docker export [options] name_of_the_container
It can be used with two syntaxes:
docker export red_panda > latest.tar
,
docker export --output="latest.tar" red_panda
docker import [options] file|url
These commands are not recommanded to use because there are other better ways to share your containers like registries.
You can check both the documentation of the docker export
command and the documentation of the docker import
command..