Install Docker and Docker Compose on Linux and post-installation

Contents

This is just a curated list of resources of how to install docker and docker compose on linux from docker official documentation. I recently installed docker twice on my centos server so I think it is worth noting it down for future use.

Docker installation and post-installation:

Daemon configuration Change data-root parameter to a custom path. Change registry-mirrors to another public or private servers. Here’s my sample config file:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
"data-root":"/my/path/docker",
"registry-mirrors": [
    "https://hub-mirror.c.163.com",
    "http://registry.docker-cn.com",
    "http://docker.mirrors.ustc.edu.cn",
    "https://ghcr.io",
    "https://mirror.baidubce.com"
  ]
}

Start docker service with sudo systemctl start docker or restart it with sudo systemctl restart docker If anything go wrong, check with

1
sudo dockerd --debug

Current latest release for V2 is v2.0.1, just follow instructions below to install it: Docker compose v2 installation

Alternatively, docker compose can be installed via pip(python’s package manager). It’s not recommended to go to this route because it may cause problem when you try to uninstall docker and docker compose.