Docker 常用命令

2023-07-28

多服务上线

sudo docker-compose up -d

多服务下线

sudo docker-compose down

容器查看

sudo docker container ls

等价于

sudo docker ps

查看所有容器信息

sudo docker ps -a

查看容器日志

sudo docker logs b80e91f12057

查看容器进程

docker top [container ID]

进程重启

docker start 79b3fa70b51d
docker exec -it 79b3fa70b51d /bin/sh

打包 image

docker save -o <path for generated tar file> <image name>

装载 image

docker load -i <path to image tar file>

注意事项

应用程序要绑定在 0.0.0.0, the container’s loopback IP address is not accessible from the host machine or other machines on the network

copyright ©2019-2024 shenzhen
粤ICP备20041170号-1