docker基本命令

 

systemctl start docker    //启动docker

docker run -it -v /data/docker/docker1:/data/user/hht –name hht centos    //运行一个centos实例

docker ps -a  //查看所有实例

docker inspect –format “{{.State.Pid}}” 89257fa2fb7b   //查看某个实例

docker start 89257fa2fb7b  //启动某个实例

sudo docker inspect 89257fa2fb7b  //查看某个实例的详细信息

sudo docker inspect -f {{.State.Pid}} 89257fa2fb7b  //获取某个实例的PID

nsenter –target 3104 –mount –uts –ipc –net –pid  //根据PID进入容器

 

 

docker rm 容器ID或容器名

1. 先 docker ps -a 寻找已经停止运行的实例
2.docker rm 59ec 删除实例
3.docker ps -a 查看实例已经删除

docker rmi 容器ID或容器名
1. 首先 docker images 查看所有镜像
2. 然后 docker rmi fe200 删除镜像
3.再次通过 docker images 查看镜像 发现已经删除

 

 

816 docker ps -a
817 dockerr ps -n 10

892 sudo yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
893 sudo yum-config-manager –enable docker-ce-edge
894 yum install docker-ce
897 yum install docker-ce-18.03.0.ce
898 yum erase docker-common-2:1.12.6-68.gitec8512b.e17.centos.x86_64
899 yum -y remove docker*
900 yum install docker-ce-18.03.0.ce
901 systemctl start docker
902 docker run hell-word
903 docker run –help
904 docker –version
911 wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.03.0.ce-1.el7.centos.x86_64.rpm
916 mkdir docker
917 chmod 777 docker/
919 cd docker/
920 mkdir docker1
921 chmod 777 docker1/
922 docker images
924 docker ps
926 docker images
927 docker ps
929 docker inspect –format “{{.State.Pid}}”
930 docker ps -l
931 docker start 89257fa2fb7b
932 docker ps
933 docker inspect –format “{{.State.Pid}}”
934 docker inspect –format “{{.State.Pid}}” 89257fa2fb7b

815 docker run -it -v /data/docker/docker1:/data/user/hht –name hht centos

Leave a Comment

电子邮件地址不会被公开。 必填项已用*标注