docker
常用命令
When you kill and remove a Docker container, you're supposed to include the -v param in docker rm, but if you don't do that, the stuff in the volume will presist in the host's filesystem until you rm -rf form /var/lib/docker/volumes/, which can be dangerous if you're not careful.
docker rm -v $(docker ps -q -f status=exited)
清理损坏的或半成品镜像
docker rmi $(docker images -q -f dangling=true)
清理残留的volume
docker volume rm $(docker volume ls -qf dangling=true)
批量启动停止的容器
docker start $(docker ps -q -f status=exited)
拷贝主机目录或文件到容器内。如果files文件夹不存在,则将前者里的所有内容移入files,否则前者移入files
docker cp /root/amazeui-2.5.1/ CONTAINER:/var/www/files
查看容器特定属性
docker inspect --format='{{ .NetworkSettings.IPAddress }}' CONTAINER
查看容器日志
# Show logs since timestamp
$ docker logs --since=2016-03-04T12:00:00 CONTAINER
# Number of lines to show from the end of the logs
$ docker logs --tail=30 CONTAINER
windows平台docker-machine对应的主机和密码docker@192.168.99.100 tcuser
linux远程文件传输命令,有git bash的windows也支持
scp -r amazeui-2.5.1/ root@liteapi.com:/root/
查看内存占用cat /proc/meminfo
网友评论