容器操作
-
使用已有的镜像运行容器
sudo docker run -it cdb68b455a14(镜像id) /bin/bash
-
运行已有容器
sudo docker start bf9d sudo docker exec -it bf9d /bin/bash
-
查看所有容器
docker ps -a
-
删除容器
docker rm -f xxx(容器id)
镜像操作
-
查看所有镜像
docker images
-
删除指定镜像
docker rmi -f xxx(镜像id)
-
拷贝文件
sudo docker cp a9_go_gateway_platform bf9d18387258:/root
宿主机与容器挂载共享目录
-
查看容器信息
sudo docker inspect bf9d
-
创建共享目录的容器
sudo docker run -itd --name=mips_bc_app -v /home/kwong/yunzhou/git/git_submodules/usv_bc_neptune_clean:/root/usv_bc_neptune_clean cdb68b455a14
-
手动修改/var/lib/docker/containers容器目录下的两个配置文件, config.v2.json
和
hostconfig.json,修改成功后,使用查看容器命令,可查看到以下信息"Binds": [ "/home/kwong/yunzhou/git/git_submodules/usv_bc_neptune_clean:/root/mips_bc_app/usv_bc_neptune_clean", "/home/kwong/yunzhou/git/go/a9_go_gateway_platform:/root/mips_bc_app/go_gateway" ], "Mounts": [ { "Type": "bind", "Source": "/home/kwong/yunzhou/git/go/a9_go_gateway_platform", "Destination": "/root/mips_bc_app/go_gateway", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Type": "bind", "Source": "/home/kwong/yunzhou/git/git_submodules/usv_bc_neptune_clean", "Destination": "/root/mips_bc_app/usv_bc_neptune_clean", "Mode": "", "RW": true, "Propagation": "rprivate" } ]
镜像安装工具
apt-get install net-tools
apt-get install vim
apt-get install file
apt-get install inetutils-ping
apt-get install libzmq3-dev
apt-get install pkg-config
apt-get install gcc-multilib
go相关配置
apt-get -qq update
apt-get -qq install -y --no-install-recommends ca-certificates curl
go env -w GOFLAGS=-buildvcs=false