Archive for the ‘Docker’ Category

Some interesting docker commands

Posted on: September 17th, 2022 by Olu No Comments

Hi folks,

Here I will talk about a few interesting commads  to know when working with Docker.

First, what is Docker? According to wikipedia, Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc. Docker can package an application and its dependencies in a virtual container that can run on any Linux, Windows, or macOS computer. This enables the application to run in a variety of locations, such as on-premises, in public (see decentralized computing, distributed computing, and cloud computing) or private cloud. When running on Linux, Docker uses the resource isolation features of the Linux kernel (such as cgroups and kernel namespaces) and a union-capable file system (such as OverlayFS) to allow containers to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines. Docker on macOS uses a Linux virtual machine to run the containers.


How to log in to a Docker artifacts repository

docker login -u someuser -p somepassword the-login-url


To build an image, you do

docker build -t name_of_container /path/to/directory-with-dockerfile/

To use a different docker file, you do

docker build -t name_of_container --file=name-of-docker-file /path/to/directory-with-dockerfile/

So, if you’re in the directory with the Dockerfile, just do

docker build -t name_of_container .


How to tag your image

docker tag your-image:latest the-repo-url/path/to/your/your-image:latest


How to push your image to a repository

docker push the-repo-url/path/to/your/image:latest


How to list Docker containers using command

docker ps


How to list Docker images using command

docker image ls


How to start a container for a particular image, making it run in the background and keeping it running indefinitely (in case it doesn’t already run that way)

docker run -d  tail -f /dev/null

How to log into a container and have a shell (good for debugging)

docker exec -it  /bin/sh


How to kill a container

docker kill <container-id>


That’s all for now. Till next time, happy software development.


Docker (software). < href=”https://en.wikipedia.org/wiki/Docker_(software)”>https://en.wikipedia.org/wiki/Docker_(software),

How to set environment variables on Docker containers via docker-compose file

Posted on: August 18th, 2022 by Olu No Comments

Hi folks,

In this post I briefly go over how to set environment variables in your docker container which is managed by a docker-compose.yaml file.

You can use the env_file flag. Suppose you set environment variables in a file .env, you can read environment variables into a container, service_name as follows:

        container_name: service_name
          - .env

That’s all for now. Till next time, happy software development.

How to keep a docker container running

Posted on: March 22nd, 2021 by Olu No Comments

Hi folks,

Just a quick tip on how to keep a docker container running. Assuming you set up a docker container and you just want to do some inspections on the container before making it run its single long-running command, you may realize that the container will exit with exit code 0 if there is no “command” flag. How then do you keep the container alive without its intended long-running command?

You can do this by using a command like:

command: tail -f /dev/null

Then once you are through with your inspection you can remove that command and add the actual desired one.

That’s all for now. Till next time, happy software development.


command: tail -f /dev/null. stackoverflow. https://stackoverflow.com/questions/44884719/exited-with-code-0-docker