docker search java
docker pull macro/eureka-server:0.0.1
docker images
docker rmi java
docker rmi -f java
docker rmi -f $(docker images)
docker run -d -p 91:80 nginx
docker ps
docker stop $ContainerId
docker kill $ContainerId
docker start $ContainerId
nsenter --target "$pid" --mount --uts --ipc --net --pid
docker rm $ContainerId
docker rm -f $(docker ps -a -q)
docker logs $ContainerIdName(或者$ContainerId)
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $ContainerId
docker cp /etc/localtime $ContainerName:/etc/
查看指定容器情况:docker stats $ContainerName
查看所有容器情况:docker stats -a
docker exec -it $ContainerName /bin/bash
docker run -d -p 5000:5000 --restart=always --name registry2 registry:2
docker push localhost:5000/macro/eureka-server:0.0.1
docker tag macro/eureka-server:0.0.1 localhost:5000/macro/eureka-server:0.0.1
tip: Linux服务器需要开启远程api:vi /usr/lib/systemd/system/docker.service 修改为:ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
command:mvn clean package docker:build -DpushImage
tip: pom.xml修改192.168.1.71:5000/macro/${project.artifactId}:${project.version}
tip: docker要支持http:echo '{ "insecure-registries":["39.98.190.128:5000"] }' > /etc/docker/daemon.json
查看Docker的存放位置:docker info | grep "Docker Root Dir"(默认为/var/lib/docker)
关闭Docker服务:systemctl stop docker
移动目录到目标路径:mv /var/lib/docker /root/data/docker
建立软连接:ln -s /root/data/docker /var/lib/docker
sudo curl -L https://raw.githubusercontent.com/docker/compose/1.22.0/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
api-gateway
编排SpringCloud微服务:见eureka-server/docker-res/docker-compose.yml
简化SpringCloud微服务编排:见eureka-server/docker-res/docker-compose-simple.yml
编排高可用的注册中心:见eureka-server/docker-res/docker-compose-eureka.yml