终于开始了新的工作,感觉非常不错。今天公司居然停电可以早点下班了,记录一下 Docker 的一些基本操作,上下班路上方便用手机复习。网上找到了这个非常好的教程 Docker Curriculum ,比官网更加简洁。
Useful commands:
-
docker build: build an image defined by Dockerfile -
docker images: list all locally available images -
docker rmi image_name: remove image -
docker run:-
docker run -c 1024 -it -w /working_directory_within_container/ -p 8888:8888 -v /full_host_dir/: /container_dir/ image_name /bin/bash:create a container from an image and run interactively with bash, with 8888 later for jupyter notebook, with full CPU usage -
docker run --rm image_name: create a container from an image and then delete it, the image can be downloaded if not available
-
-
docker load -i: load an image from tar file -
docker pull: download images -
docker ps -a: all runed containers -
docker container stop container_name: stop a running container -
docker rm container_name: remove a container -
docker rm $(docker ps -a -q -f status=exited)==docker container prune - Run an existed container
docker container start container_namedocker exec -it container_name /bin/bashjupyter notebook --ip 0.0.0.0 --port 8888 --no-browser --allow-root