The docker-compose build or docker-compose up –build commands read the docker-compose.yml file looking for all services containing the build configuration option and run a docker build command for each of them. If the Dockerfile has been renamed or placed out of the context directory, you can specify the alternate path in the Docker Compose file. […]
docker
Docker: Remove All Images & Containers
This short note shows how to remove all Docker images and containers. Use these commands with caution as they force the removal of all the Docker images and containers including the running ones.
Alpine: Install Package
A minimal Docker image based on Alpine Linux has only 5 MB in size, but a lot of packages common for Linux distributions are not installed by default. In this short note i will show how to install a package in Alpine container from the command line using the apk (Alpine package manager). I will […]
Docker: Login Command – Registry Login & Logout
To start using a private Docker Registry a user usually should run the docker login command and set a username and password that will be cached locally. If a user tries to docker pull or docker push an image from/to a private Docker Registry, without having run the docker login command in advance, he may […]
Docker: Run Multiple Commands in Container
Multiple commands can be executed in a running Docker container using the docker exec command. If the Docker container is stopped, before running the docker exec command it should be started using the docker run command. In this short note i will show the examples of how to execute multiple commands in a Docker container.
Docker: Run Command in Container – Exec Example
The docker exec command serves for executing commands in a running container. If the Docker container is stopped, before running the docker exec command it should be started using the docker run command. In this short note i will show the examples of how to execute commands Docker containers.
Docker: Label Image on Build (Dockerfile) – Example
Adding labels to Docker images is a good practice as this custom metadata permits to organize images by environments, record build information and is very helpful in automation. This guide will show you 2 ways of how to add custom metadata to Docker images.
Docker: Layers – Show Image Layers & Size
Docker image is built up from a series of layers that represent instructions in the image’s Dockerfile. Sometimes it may be necessary to show an image layers, their sizes and the instructions they have been created of. In this note i will show how to list all layers a Docker image is composed of, show […]
Docker: Tag Image – Build with Tag, Remove, Re-Tag
The good practice is to tag Docker images with useful tags, e.g. version, intended destination (prod or staging), stability or any other information that is useful when deploying the application in different environments. In this note i will show how to tag Docker images with one or multiple tags during a build. Also i will […]
Alpine: Install cURL
A minimal Docker image based on Alpine Linux has only 5 MB in size, but a lot of tools common for Linux distributions (e.g. curl) are not installed by default. In this short note i will show how to install curl in Alpine container from the command line. I will also show how to build […]