Start Docker container after linux boot

Docker provides restart policies to control whether your containers start automatically when they exit, or when Docker restarts. Restart policies start linked containers in the correct order. Docker recommends that you use restart policies, and avoid using process managers to start containers.

Restart policies are different from the –live-restore flag of the dockerd command. Using –live-restore lets you to keep your containers running during a Docker upgrade, though networking and user input are interrupted.

The following command starts a Redis container and configures it to always restart, unless the container is explicitly stopped, or the daemon restarts.

Read more

Share

How To Install and Use Docker Compose on Rocky Linux 8

Step 1 — Installing Docker

The Docker installation package available in the official Rocky Linux 8 repository may not be the latest version. To get the latest and greatest version, install Docker from the official Docker repository. This section shows you how to do just that.

But first, let’s update the package database:

sudo dnf check-update

Next, add the official Docker repository:

sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

While there is no Rocky Linux specific repository from Docker, Rocky Linux is based upon CentOS and can use the same repository. With the repository added, install Docker, which is composed of three packages:

sudo dnf install docker-ce docker-ce-cli containerd.io

After installation has completed, start the Docker daemon:

sudo systemctl start docker

Verify that it’s running:

sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:

Read more

Share

Install PHPIPAM using Docker on CentOS 7

Update Docker Package Database. In a terminal window, type:

sudo yum check-update

Remove if any docker is preinstalled with your OS-

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

Install the Dependencies

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

The –y switch indicates to the yum installer to answer “yes” to any prompts that may come up. The yum-utils switch adds the yum-config-manager. Docker uses a device mapper storage driver, and the device-mapper-persistent-data and lvm2 packages are required for it to run correctly.

Read more

Share

Install Nginx Proxy Manager on CentOS 7

Nginx Proxy Manager is built on docker container. So, we need to deploy Docker first.

Update Docker Package Database. In a terminal window, type:

sudo yum check-update

Allow the operation to complete.

Remove if any docker is preinstalled with your OS-

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

Install the Dependencies

Type in the following command:

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

The –y switch indicates to the yum installer to answer “yes” to any prompts that may come up. The yum-utils switch adds the yum-config-manager. Docker uses a device mapper storage driver, and the device-mapper-persistent-data and lvm2 packages are required for it to run correctly.

Read more

Share

Install Percona Monitoring and Management using Docker

You can any distribution for installation- Rocky/Alma/CentoS 8 Stream. I assume you’ll use anyone of these instance.

Step 1: Add Docker Repository

Docker is not yet available on default repositories. Thankfully, an official repository has been provided by developers and we are going to add it first to the system. On your terminal, run the following command to add the Docker repository

$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Step 2: Install Docker in Rocky Linux/AlmaLinux

Moving on, we are going to install the Docker community edition which is freely available for download and use. But first, update the packages.

$ sudo dnf update

Next, run the command below to install Docker CE, the command-line interface (CLI), and other essential tools and dependencies.

Read more

Share

Pushing Docker Images to a Docker Repository

The next logical step after creating a new image from an existing image is to share it with a select few of your friends, the whole world on Docker Hub, or other Docker registry that you have access to. To push an image to Docker Hub or any other Docker registry, you must have an account there.

This section shows you how to push a Docker image to Docker Hub. To learn how to create your own private Docker registry, check out How To Set Up a Private Docker Registry on Ubuntu 14.04.

To push your image, first log into Docker Hub.

docker login -u docker-registry-username

You’ll be prompted to authenticate using your Docker Hub password. If you specified the correct password, authentication should succeed.

Read more

Share

Docker Commands

Working with Docker Images

Docker containers are built from Docker images. By default, Docker pulls these images from Docker Hub, a Docker registry managed by Docker, the company behind the Docker project. Anyone can host their Docker images on Docker Hub, so most applications and Linux distributions you’ll need will have images hosted there.

To check whether you can access and download images from Docker Hub, type:

docker run hello-world

The output will indicate that Docker in working correctly:

Output
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.
...

Docker was initially unable to find the hello-world image locally, so it downloaded the image from Docker Hub, which is the default repository. Once the image downloaded, Docker created a container from the image and the application within the container executed, displaying the message. You can search for images available on Docker Hub by using the docker command with the search subcommand. For example, to search for the Ubuntu image, type:

Read more

Share

Install Docker on Debain 10

Installing Docker

The Docker installation package available in the official Debian repository may not be the latest version. To ensure we get the latest version, we’ll install Docker from the official Docker repository. To do that, we’ll add a new package source, add the GPG key from Docker to ensure the downloads are valid, and then install the package.

First, update your existing list of packages:

sudo apt update

Next, install a few prerequisite packages which let apt use packages over HTTPS:

sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common

Then add the GPG key for the official Docker repository to your system:

Read more

Share

Install portainer on ubuntu 16 docker

Step 1 – Install Docker on Ubuntu 16.04 LTS
Before installing docker packages, please update the repository on your system and upgrade packages.

sudo apt update
sudo apt upgrade

Now install docker using the apt command below.

sudo apt install docker.io -y

After the installation is complete, start docker service and enable it to launch everytime at system boot.

systemctl start docker
systemctl enable docker

Docker installed on ubuntu 16.04 server, check it using the command below.

docker version

And you will get the docker version 1.x installed on the system.

Step 2 – Install and Configure Portainer
Portainer can be installed as a docker container and standalone without docker container.

Read more

Share

Sharing Volumes Between Containers

There are many situations where it is useful to share a Docker volume between containers, and several ways to accomplish this goal.

Sharing a Volume on the Host

If you create a volume on the host machine, it can be used by multiple different containers at once. This allows you to share data between containers and the host.

For this example we will create a directory on the host, and use that directory as a shared volume between two containers.

Begin by creating a directory to use as a Docker volume with the command:

sudo mkdir /webdata

Create a small test file in this directory with the command:

sudo echo "Hello from the host." >> /webdata/host-hello.txt

Next, launch a container named sql-database from the official PostgreSQL image, and map /webdata on the host to /data on the container with the command:

sudo docker run -it --name sql-database -v /webdata:/data postgres /bin/bash

Once you are at the new container’s command prompt verify that the shared volume is set up correctly with the command:

ls /data

You will see the host-hello.txt file which we created on the host. Let’s add a file to this shared volume with the command:

Read more

Share