Skip to content

Instantly share code, notes, and snippets.

@nlpjoe
Last active August 18, 2020 07:12
Show Gist options
  • Save nlpjoe/59426aaaed34abdcf45457946de385b3 to your computer and use it in GitHub Desktop.
Save nlpjoe/59426aaaed34abdcf45457946de385b3 to your computer and use it in GitHub Desktop.
[docker使用] #coding

sudo docker start ${HOME}

# 无需任何修改,直接执行这个命令即可;如要修改,请参考`docker启动参数的说明`中的说明
sudo docker run -d --name=${USER} --net=host -u `id -u`:`id -g`              \
                -v /etc/passwd:/etc/passwd:ro -v ${HOME}:${HOME}             \
                -w `pwd` -it reg.docker.alibaba-inc.com/dii/dii_alios7u2_dev \
                /bin/bash
# 默认我们使用了当前用户名,作为docker的container名称
# 通过以上命令启动的docker container已经在后台运行了,只要不停止和删除会一直存在

sudo docker attach xxx(containerID)

sudo docker ps 查看所有container
sudo docker exec -it ${USER} /bin/bash # 假定你使用的docker container的名称为${USER}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment