Docker

2020-08-17

  • 1 Basics
    • 1.1 Basic commands
  • 2 Installation
    • 2.1 CentOS 7
      • 2.1.1 Error container-selinux >= 2.9
  • 3 Docker Hub
    • 3.1 Use the mirror in the mainland of China

1 Basics

1.1 Basic commands

Run a container from an image

docker run -name learn -i -t rbnics/rbnics /bin/bash
  • -name learn specifies the name of the container
  • -i keeps STDIN open even if not attached
  • -t allocates a pseudo-TTY
  • /bin/bash is the command name after the container starts
  • rbnics/rbnics is the image name

2 Installation

2.1 CentOS 7

References

  • 1

2.1.1 Error container-selinux >= 2.9

You need to install the latest epel repo to install the required version of container-selinux.

Reference

Remember to add the user to the docker group to avoid sudo.

sudo usermod -aG docker $USER

3 Docker Hub

3.1 Use the mirror in the mainland of China

Edit the config /etc/docker/daemon.json to add

{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}

Then restart docker

sudo systemctl restart docker

Reference

.
Created on 2020-08-17 with pandoc