docker basic maintenance commands

docker search centos ## The above image search server;
Docker Images check local mirror ##.
docker pull centos ## pull the mirror.

RUN CentOS Docker / bin / echo 'the Hello World' ##
Docker RUN -d --name mycentos1 CentOS background image ## called centos, testcentos container named container of
docker stop testcentos1 ## stops container testcentos1
Docker Start # testcentos1 # run existing container testcentos1


docker run --name testcentos -it centos / bin / bash ## centos mirror called the testcentos container program you run / bin / bash
## into the container has been running.

docker container prune # delete all containers are not running
docker rmi $ (docker images -q) # ## to remove all mirrors

docker stop $ (docker ps -q) && docker rm $ (docker ps -aq) ## to remove all containers

docker inspect --format "{{.State.Pid}}" registry ## to obtain the container of registry name pid

 

Script ## into the vessel

#!/bin/bash
Cname=$1
Cpid=$(docker inspect --format "{{.State.Pid}}" ${Cname})
nsenter --target ${Cpid} --mount --uts --ipc --net --pid

Guess you like

Origin www.cnblogs.com/liulvzhong/p/11516982.html
Recommended