/
Docker Engine Install

Docker Engine Install

1. Install Docker engine

Follow actual Install Docker Engine on Ubuntu and you can skip current step.

Run command:

docker version

If you got the screen like:

 

follow Set docker log limit and skipping next commands in the current step.

Else if you got the answer similar to:

 

Update the apt package index and install packages to allow apt to use a repository over HTTPS:

apt-get update apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release

Add Docker’s official GPG key:

mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Use the following command to set up the repository:

echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine:

apt-get update apt-get install docker-ce docker-ce-cli containerd.io

Check the docker engine was successfully installed through viewing the version:

docker version

the result should be like:

2. Set docker log limit

You should set docker log limit: max-size: 2m, max-file 3 (take for example: JSON File logging driver ):

Below used the 'vim' text editor.

Note: If you have issues using this editor please use 'nano' as alternative or install visual shell for your remote machine

vim /etc/docker/daemon.json

Write next log options data inside daemon.json file and save it

{ "log-driver": "json-file", "log-opts": { "max-size": "2m", "max-file": "3" } }

restart docker service to apply log limit:

service docker restart

check docker service to apply log limit:

service docker status

You should get green status if service is OK:

3. Dry-run Docker

docker run --rm hello-world

Related content