sh Docker备忘单

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Docker备忘单相关的知识,希望对你有一定的参考价值。

docker build -t friendlyname .  # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyname  # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyname         # Same thing, but in detached mode
docker container ls                                # List all running containers
docker container ls -a             # List all containers, even those not running
docker container stop <hash>           # Gracefully stop the specified container
docker container kill <hash>         # Force shutdown of the specified container
docker container rm <hash>        # Remove specified container from this machine
docker container rm $(docker container ls -a -q)         # Remove all containers
docker image ls -a                             # List all images on this machine
docker image rm <image id>            # Remove specified image from this machine
docker image rm $(docker image ls -a -q)   # Remove all images from this machine
docker login             # Log in this CLI session using your Docker credentials
docker tag <image> username/repository:tag  # Tag <image> for upload to registry
docker push username/repository:tag            # Upload tagged image to registry
docker run username/repository:tag                   # Run image from a reg

docker run -d image # run image
docker ps # see all the containers running
docker run -d --name redisHostPort -p 6379:6379 redis:latest # runs the container in detached mode and exposes the port
docker run -it -p 8787:8787 --name hello trallad/hello
docker run -d -p 8787:8787 -v $(pwd):/home/rstudio rocker/rstudio # link a local volume to the studio container 
docker build --rm --force-rm -t trallard/container .  # builds the image from the souce path and removes the container once exited

docker inspect --format='{{.Id}} {{.Parent}}' \
    $(docker images --filter since=f50f9524513f --quiet)

docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r | column -t  # sort Docker images per size

以上是关于sh Docker备忘单的主要内容,如果未能解决你的问题,请参考以下文章

sh 用于在Docker容器中运行本地Node项目的个人备忘单

sh Azure命令备忘单

sh 备忘单

sh InfluxDB备忘单

sh Linux备忘单

sh Salesforce SFDX备忘单