# docker-library **Repository Path**: sancode/docker-library ## Basic Information - **Project Name**: docker-library - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2018-05-28 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### docker hub国内镜像 ```bash curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://ef017c13.m.daocloud.io ``` ### docker容器 1. docker镜像清理 ``` docker rmi $(docker images -f "dangling=true" -q) ``` ``` # 删除未运行的容器 docker rm $(docker ps -a -q) ``` 2. 当前目录构建docker镜像 ``` docker build -t userapp . ``` 3. Docker run ``` docker run -e DISCONF_ENV=rd -e CONF_SERVER_HOST=conf.ziyouchi.com --name basicapp basicapp:latest ``` 4. docker与docker compose安装 ``` curl -sSL https://get.daocloud.io/docker | sh ``` ``` curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose ``` 赋予权限 ``` $ chmod +x /usr/local/bin/docker-compose ``` ### linux 命令说明 1. `dirname $0` ```text 这个命令写在脚本文件里才有作用,他返回这个脚本文件放置的目录,并可以根据这个目录来定位所要运行程序的相对位置(绝对位置除外)。 $0:当前Shell程序的文件名 dirname $0,获取当前Shell程序的路径 cd `dirname $0`,进入当前Shell程序的目录 ``` 2. pwd 命令来查看”当前工作目录“的完整路径。 ```text [root@localhost ~]# pwd /root [root@localhost ~]# cd /opt/soft/ [root@localhost soft]# pwd /opt/soft ``` 3. pwd -P ```text 目录连接链接时,pwd -P 显示出实际路径,而非使用连接(link)路径;pwd显示的是连接路径命令: 输出: [root@localhost soft]# cd /etc/init.d [root@localhost init.d]# pwd /etc/init.d [root@localhost init.d]# pwd -P /etc/rc.d/init.d [root@localhost init.d]# ``` 4. sed [sed命令用于处理文本文件如修改配置文件](https://blog.csdn.net/xianjie0318/article/details/68923747) 5. git撤销所有修改 ```text 1. git clean -df 2. git reset --hard ```