3 Star 0 Fork 0

Gitee 极速下载 / dock

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/bripkens/dock/
克隆/下载
common 1.51 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
force_stop() {
docker stop $1 &> /dev/null
docker rm $1 &> /dev/null
}
inspect() {
if hash docker-machine 2>/dev/null; then
docker-machine ssh $DOCKER_MACHINE_NAME docker inspect --format=$2 $1
elif hash boot2docker 2>/dev/null; then
boot2docker ssh docker inspect --format=$2 $1
else
docker inspect --format=$2 $1
fi
}
get_ip() {
if hash docker-machine 2>/dev/null; then
docker-machine ip $DOCKER_MACHINE_NAME 2>/dev/null
elif hash boot2docker 2>/dev/null; then
boot2docker ip 2>/dev/null
else
# The following gives the ip address of the container. We
# don't need this information though. On Linux systems the
# systems can be accessed via 127.0.0.1
# docker inspect --format={{.NetworkSettings.IPAddress}} $1
echo "127.0.0.1"
fi
}
run() {
docker run "$@"
local status=$?
if [ $status -ne 0 ]; then
echo >&2
echo "Failed to start the Docker container." >&2
exit 1
fi
local container_id="$(docker ps -n=1 | tail -n 1 | awk '{print $1}')"
local container_name=$(inspect $container_id '{{.Name}}')
# strip the leading / character
container_name=${container_name#?}
local container_ip=$(get_ip $container_id)
local host_ports=$(inspect $container_id '' | \
grep HostPort | \
sed 's/[^0-9]*//g' | \
sort -nu)
echo "Container started"
echo "Name: $container_name"
echo "IP: $container_ip"
echo "Ports: $(echo $host_ports | tr '\\n' ',')"
}
Shell
1
https://gitee.com/mirrors/dock.git
git@gitee.com:mirrors/dock.git
mirrors
dock
dock
master

搜索帮助