The second usage basis docker Docker

 

Docker in container

  lxc -> libcontainer -> runC

OCI (Open Container Initiative) 

  Led by the Linux Foundation, founded in June 2015

  Role is specified when the container format and run around an open industry standard

 

docker architecture consists of several parts:

   docker daemon   

  docker client

  docker Registry

Installation and use of docker

  Dependent basic environment:

    64 bits CPU

    Linux Kernel 3.10+

    Linux Kernel cgroup and namespaces

 installation

  Tsinghua Source: https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/

  cd /etc/yum.repo

  moved https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo

 

  Modify the source

  Into the docker-ce.repo

  :%s@https://download.docker.com@https://mirrors.tuna.tsinghua.edu.cn/docker-ce/@

    

  Installation: yum install docker-ce

  Profile /etc/docker/daemon.json (need to create your own directory does not exist)

  

  docker Mirror accelerate

  docker cn

  Ali Cloud Accelerator

  China University of Science and Technology

  {

    "registry-mirrirs": ["https://registry.docker-cn.com"]

  }

  

启动时报错了:Job for docker.service failed because the control process exited with error code. See "systemctl sta

Json format may be concluded that there is a problem handwriting again after the problem is solved

{
"storage-driver":"devicemapper"
}

After the storage system has two overlay2 system and devicemapper 7.4 version supports overlay2 good performance

 

Common operations:

  docker search image search

  docker pull: pulling mirroring

  docker images to view mirror

  docker create create a new container

  docker start 

  docker run

  docker attach

  docker ps

  docker logs

  docker restart

  dockeer stop

  docker kill

  docker rm

  

Download miniature nginx Mirror

  docker image pull nginx:1.14-alpine

Delete two ways mirror:

  docker image rm mirror name

  docker rmi mirror name

List all mirrors

  docker image ls

  docker images

  docker image ls --no-trunc

View container:

  docker container ls

  docker ps

  docker ps -a view of the container used (comprising the container is not run)

Open an interactive container:

  docker run --name b1 -it busybox: latest (create container but can also be created does not start automatically)

    -t: terminal run

    -i: interactive operation

    -d: background

Exit interface (while the container will also stop)

  exit

Start container

  docker start -i -a b1

Stop the container:

  docker stop container ID | container name

  docker kill container ID | container name (equivalent to the difference between the two inside linux-9 and -15 difference)

 

Delete container (only stopped can be deleted)

  docker rm container name

 

Into the container which execute interactive commands:

  docker exec -it kvstor1 /bin/bash

 

See container log (printed directly above the terminal)

  docker logs web1

Guess you like

Origin www.cnblogs.com/guniang/p/11593442.html