Docker learning process (B): Docker installation configuration and basic usage

A. Installation Docker-ce (installation documentation from Ali mirror sites http://u6.gg/sMVvC)

    1. Install the necessary system tools: sudo yum -y install yum-utils device-mapper-persistent-data lvm2

    2. Add the software source information: sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

    3. Generate cache information: sudo yum makecache fast

    4.安装Docker-ce:sudo yum -y install docker-ce

    5. Turn IPV4 forwarding: vim /etc/sysctl.conf

1 net.ipv4.ip_forward=1

    6. Create a json file accelerate image download speed: vim /etc/docker/daemon.json

1 {
2   "registry-mirrors": ["https://registry.docker-cn.com"]
3 }

    7.启动Docker:systemctl start docker

    8. Verify Docker information: docker info or docker --version

    9.Docker need to start iptables to do port mapping service, but default firewalld in CentOS7 be managed, it could lead to the use of Docker's problem, you can do the following to install their own use iptables

  • systemctl disable firewalld
  • yum -y install iptables-services
  • systemctl enable iptables

The basic use of two .Docker of:

    1. Mirror specific operation instructions:

docker images Check local mirror
docker search image name Mirror search resources (no image name / separator is generally mirrored top warehouse resources, there is / are generally separated by private enterprise warehouse or warehouse)
docker image pull mirror name: Label Mirror Pull
docker image ls --no-trunc View image details
docker rmi image name / id Remove Mirror
docker load/save Import / Export image file

    2. Specific container Options:

start(-i/-a)/stop Start (interactive mode / additional terminal) / stop the container
kill Forced to stop container
run After creating the container directly start
pause/unpause Pause / Resume container
ps/container ls View a list of running container
PS-A See all the container list
rm Delete container

      Where the parameters are used when creating the container run:

-t Program specified container terminal
-i Interactive access
--name Specified container name
--rm Container automatically deleted when you stop
-d Container running in the background
--network Container designated network mode (default bridge)

Guess you like

Origin www.cnblogs.com/intifi/p/12129315.html