Open cloudscode opened 7 years ago
cat > /etc/yum.repos.d/docker.repo <<-EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/experimental/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF
yum -y install docker-engine
systemctl enable docker
systemctl start docker
docker info
systemctl restart docker
docker images
docker rmi -f [IMAGE ID]
docker ps
docker ps -a
docker rm -f $(docker ps -a -q)
docker build -t pft/centos:7.1 .
docker start dockerId
docker stop dockerId
docker run -d -p 5000:5000 --name registry registry
#
docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry
docker push 192.168.1.128:5000/test/jdk:1.8
docker commit oldimage mynewimage
docker inspect imageId
docker export 634bb > centosposeidon.tar
cat centosposeidon.tar | sudo docker import - pft/centosposeidon:v1.0
sudo docker import http://viabugs.com/centosposeidon.tgz pft/centosposeidon:v1.0
docker-compose -v
docker-compose up
docker-compose up -d
docker-compose stop
docker-compose ps
docker-compose ps -a
docker-compose rm
不要用ctrl+c,ctrl+c是让docker容器停止了。
用如下快捷键:先按:ctrl+p;再按:ctrl+q。
VOLUME 指令创建的挂载点,无法指定主机上对应的目录,对应目录是自动生成的,用命令查看docker inspect。
VOLUME ["/var/jetty/pft/web/logs"]
通过docker inspect 查看通过该dockerfile创建的镜像生成的容器,通过Mounts属性看挂载点的信息。
"Mounts": [
{
"Type": "volume",
"Name": "0314887f053cfa6fa7ab78880493135fb91ce6c79644b37651b15b168bed387c",
"Source": "/var/lib/docker/volumes/0314887f053cfa6fa7ab78880493135fb91ce6c79644b37651b15b168bed387c/_data",
"Destination": "/var/jetty/pft/web/logs",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
]
http://www.cnblogs.com/suredandan/p/6559113.html http://www.cnblogs.com/zhangmingcheng/p/6587020.html
vi /lib/systemd/system/docker.service
ExecStart=/usr/bin/docker daemon --tls=false -H unix:///var/run/docker.sock -H tcp://192.168.20.250:4243
systemctl daemon-reload && systemctl restart docker
curl http://192.168.20.250:4243/v1.24/info
Usage: docker restart [OPTIONS] CONTAINER [CONTAINER...]Restart a running container
docker cp /var/java/apache-maven-3.3.9.7z 90a9b5b2405d:/usr/local/package
docker exec -it {容器id} bash
Learing Docker