docker 使用

2019-12-09  本文已影响0人  sudocloud

安装:

sudo apt-get install docker.io

解决docker启动权限不足问题

sudo gpasswd -a $USER docker##将登陆用户加入到docker用户组去
newgrp docker ## 更新用户组

image 操作:

docker hub

download image

docker pull ubuntu:16.04

delete image

docker rmi ubuntu:16.04

list images

docker images

save image

docker save -o ubuntu16_04.tar ubuntu:16.04 

load image

docker load -i ubuntu16_04.tar 

image info

docker inspect ubuntu:16.04

container 操作:

create container

docker create -p 10080:80 --name web ubuntu:16.04

start container

docker start web

entry container

docker exec -it web /bin/bash
docker attach web 进程绑定

delete container

docker rm  web

pause container

docker pause web

stop container

docker stop web

list container

docker ps -a

create start and run container

docker run -it -p 10080:80 --name web ubuntu:16.04 /bin/bash

diff container between image

docker diff web

commit container to image

docker commit -m "web with nginx" web web:lnmp

share folder to container

 docker run -it --name test  -v ~/data:/share ubuntu /bin/bash
上一篇 下一篇

猜你喜欢

热点阅读