Command
Login
1 | docker login localhost:8080 |
GCP Login
- https://cloud.google.com/container-registry/docs/advanced-authentication#json_key_file
- http://docs.heptio.com/content/private-registries/pr-gcr.html
容器
创建容器
shell方式
docker run -it image:tag
进入容器
Shell方式
1 | docker exec -it 775c7c9ee1e1 /bin/bash |
docker-enter
创建执行文件
1
sudo vim /usr/bin/docker-enter
添加执行命令
1
2
3
4
5
6
7
8
9
10
11
12
EXPECTED_NUM_ARGS=1;
if [ "$#" -ne $EXPECTED_NUM_ARGS ]; then
# user didn't specify which container ID, assume the latest one
CONTAINER_ID=`/usr/bin/docker ps -q --no-trunc | /bin/sed -n 1p`
/usr/bin/docker exec -it $CONTAINER_ID env TERM=xterm bash
else
# enter the container the user specified
/usr/bin/docker exec -it $1 env TERM=xterm bash
fi添加运行权限
1
sudo chmod +x /usr/bin/docker-enter
镜像
构建镜像
删除镜像
删除本地镜像
1 | docker rmi [选项] <镜像1> [<镜像2> ...] |
删除所有虚悬镜像
1 | sudo docker rmi -f $(docker images -q -f dangling=true) |