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
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 […]
Docker: Start Container – Docker Run Command
A docker run command is one of the basic commands in a Docker universe as it is used to start containers from Docker images. In this short note i will show how to start a Docker container in a foreground, in a background or with an interactive shell session of bash or sh from the […]
Install Docker on Ubuntu-18.04
For ones, who want to build and run Docker containers on Ubuntu-18.04 – first of all it is required to install Docker itself. To install the latest version of Docker and to be able to upgrade it easily in future – it is recommended to install Docker from the official repository. In this guide i […]
Prometheus Monitoring: Install using Docker – Ubuntu, CentOS
What is Prometheus? Prometheus is an open-source monitoring and alerting software written in Go. It collects metrics from configured targets and stores them in a local time series database. Prometheus can run rules over collected data to either aggregate and record new time series from existing data or generate alerts. To visualize the collected data […]
Install Docker Compose – Ubuntu, CentOS, MacOS
What is Docker Compose? The docker-compose is a tool for defining and running complex multi-container Docker applications. With docker-compose you can define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running. In this note i’ll show […]
Docker: Reload Nginx Inside Container
If you want to update Nginx configuration or renew SSL certificates, you should reload Nginx to apply modifications. If you run Nginx inside Docker container you might be curious how to reload it without any downtime or connection interruptions. The best way to reload Nginx inside Docker container is to run docker container exec command […]