Linux:Docker:修订间差异
imported>Soleverlee 小 Soleverlee移动页面Osx:Docker至Linux:Docker,不留重定向 |
imported>Soleverlee |
||
(未显示同一用户的2个中间版本) | |||
第7行: | 第7行: | ||
docker pull | docker pull | ||
docker inspect f7b3f317ec73 #列出详细信息 | docker inspect f7b3f317ec73 #列出详细信息 | ||
docker ps -a | |||
docker rm container-name | |||
docker rm image-id | |||
docker logs container-name | |||
</source> | |||
=交互= | |||
<source lang="bash"> | |||
docker run ubuntu:15.10 /bin/echo "Hello world" | |||
docker run -i -t ubuntu:16.04 /bin/bash | |||
</source> | </source> | ||
=查看所有tags= | =查看所有tags= | ||
<source lang="bash"> | <source lang="bash"> | ||
第29行: | 第41行: | ||
image="$1" | image="$1" | ||
tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags \ | ||
-O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' \ | |||
| awk -F: '{print $3}'` | |||
if [ -n "$2" ] | if [ -n "$2" ] | ||
第37行: | 第51行: | ||
echo "${tags}" | echo "${tags}" | ||
</source> | |||
将以上代码保存到/usr/local/bin | |||
<source lang="bash"> | |||
chmod +x /usr/local/bin/dockertags | |||
dockertags ubuntu | |||
</source> | </source> | ||
[[Category:Linux/Unix]] | [[Category:Linux/Unix]] |
2017年6月18日 (日) 11:08的最新版本
基本命令
安装现在直接下载dmg安装就可以了。目测会和VirtualBox什么的冲突,导致死机...
docker images
docker search ubuntu
docker pull ubuntu
docker pull
docker inspect f7b3f317ec73 #列出详细信息
docker ps -a
docker rm container-name
docker rm image-id
docker logs container-name
交互
docker run ubuntu:15.10 /bin/echo "Hello world"
docker run -i -t ubuntu:16.04 /bin/bash
查看所有tags
#!/bin/bash
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
EXAMPLE:
- list all tags for ubuntu:
dockertags ubuntu
- list all php tags containing apache:
dockertags php apache
HELP
fi
image="$1"
tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags \
-O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' \
| awk -F: '{print $3}'`
if [ -n "$2" ]
then
tags=` echo "${tags}" | grep "$2" `
fi
echo "${tags}"
将以上代码保存到/usr/local/bin
chmod +x /usr/local/bin/dockertags
dockertags ubuntu