常用的docker命令
官网传送门
镜像相关
imagename=$registry/$image_name:$tag
docker search $imagename
docker login $registry -u $username -p $password
docker pull $imagename
docker tag $old_imagename $new_imagename
docker push $imagename
docker commit $containerId $new_imagename
docker save $imagename -o $zipname.tar
docker load -i $zipname.tar
docker images
docker rmi $imagename
docker history -H $imagename
docker build -t $imagename $filepath
容器启动、调试
docker ps -a -n 3 --filter "STATUS=exited" --no-trunc --format "table {
{.ID}}\t{
{.Command}}\t{
{.Ports}}\t{
{.Networks}}"
docker run -d --privileged --rm --name my_ctn --link other_ctn --volume /src:/dst --volumes-from third_ctn:rw redis:4.0
docker inspect $containerId
docker diff $containerId
docker start $containerId
docker stop $containerId
docker kill $containerId
docker rm $containerId