Linux:Docker
基本命令
安装现在直接下载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