practical operation docker

1) Set the mirror acceleration docker

docker after installation default is not daemon.json this profile, you need to be created manually. The default path to the configuration file: /etc/docker/daemon.json.

daemon.json file configurable parameter table, we are in the process of configuration, you only need to set the parameters we need, all without having to write it down. Detailed reference to the official website.

Official configuration address: https: //docs.docker.com/engine/reference/commandline/dockerd/#/configuration-reloading

Official configuration address: https: //docs.docker.com/engine/reference/commandline/dockerd/#options

Official configuration address: https: //docs.docker.com/engine/reference/commandline/dockerd/#/linux-configuration-file


Example:

[root@wsl ~]# cat /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}
[root@wsl ~]# 

  After completion of the save, the next step to accelerate the implementation of the entry into force

  1, finished modifying the file is reloaded

[root @ wsl ~] # systemctl daemon-reload / reload 
[root @ wsl ~] # systemctl restart docker / restart docker services 
[root @ wsl ~] # systemctl status docker / View Status

 

   View the service, whether to use a mirror to accelerate docker

[root@wsl ~]# docker info
Client:
 Debug Mode: false

 Registry Mirrors:
  https://registry.docker-cn.com/
 Live Restore Enabled: false

2) docker docker info to view version information and inspection

[root@wsl ~]# docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:25:41 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:24:18 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
[root@wsl ~]# 

  docker  info:

[root@wsl ~]# docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 19.03.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-514.26.2.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.796GiB
 Name: wsl
 ID: WDDJ:DBSB:2RMA:PMXU:PDO6:ZWSX:B5WU:4CMK:TTGY:D3A5:QEBK:O3D5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://registry.docker-cn.com/
 Live Restore Enabled: false

  

3) the operation of the mirror:
1. Acquire image
gain:
Docker pull mirror name: the TAG
Delete:
delete the image, we can not directly delete container dependent mirror
docker rmi image name / ID
docker rmi -f image name / ID
change:
Docker tag
check:
Check local mirror
docker images

4) Operation of container:
by:
1. Create the container and run
run --name container -d -p host name port Docker: mirroring container port basis
Examples: docker run --name web1 -d -p 80:80 nginx : latest
delete:
delete the container, we can not directly delete a container is running, we need to stop and then delete or -f, forced to delete
Docker RM web1
Docker RM -f web1
change:
container rename
docker rename
the container start and stop
docker start / stop / restart vessel name
docker pause container name \\ suspended container (hang)
Docker unpause vessel name \\ unpauses container
docker update \\ update container configuration
replication between docker cp \\ container and the host file, the default cover existing file
check:
container to view the running
docker ps
view all containers
docker ps -a
Docker stats container name \\ check the status of container
docker top container vessel name \\ view the processes running

Guess you like

Origin www.cnblogs.com/security-guard/p/12146926.html