@bergus
2016-07-15T18:42:05.000000Z
字数 4062
阅读 1640
服务器
base ubuntu
docker run -d -p 0.0.0.0:2222:22 tutum/ubuntu:trusty
docker run -d -p 2222:22 -e ROOT_PASS="mypass" tutum/ubuntu:trusty
docker run -d -p 2222:22 -e AUTHORIZED_KEYS="cat ~/.ssh/id_rsa.pub" tutum/ubunt
进入容器内部快捷的方法。在家目录创建一个.bashrc_docker文件,内容如下:
# Some useful commands to use docker.
# Author: yeasy@github
# Created:2014-09-25
alias docker-pid="sudo docker inspect --format '{{.State.Pid}}'"
alias d你只要运行一个用于启动应用及其依赖的脚本ocker-ip="sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
#the implementation refs from https://github.com/jpetazzo/nsenter/blob/master/docker-enter
function docker-enter() {
#if [ -e $(dirname "$0")/nsenter ]; then
#Change for centos bash running
if [ -e $(dirname '$0')/nsenter ]; then
# with boot2docker, nsenter is not in the PATH but it is in the same folder
NSENTER=$(dirname "$0")/nsenter
else
# if nsenter has already been installed with path notified, here will be clarified
NSENTER=$(which nsenter)
#NSENTER=nsenter
fi
[ -z "$NSENTER" ] && echo "WARN Cannot find nsenter" && return
if [ -z "$1" ]; then
echo "Usage: `basename "$0"` CONTAINER [COMMAND [ARG]...]"
echo ""
echo "Enters the Docker CONTAINER and executes the specified COMMAND."
echo "If COMMAND is not specified, runs an interactive shell in CONTAINER."
else
PID=$(sudo docker inspect --format "{{.State.Pid}}" "$1")
if [ -z "$PID" ]; then
echo "WARN Cannot find the given container"
return
fi
shift
OPTS="--target $PID --mount --uts --ipc --net --pid"
if [ -z "$1" ]; then
# No command given.
# Use su to clear all host environment variables except for TERM,
# initialize the environment variables HOME, SHELL, USER, LOGNAME, PATH,
# and start a login shell.
#sudo $NSENTER "$OPTS" su - root
sudo $NSENTER --target $PID --mount --uts --ipc --net --pid su - root
else 你只要运行一个用于启动应用及其依赖的脚本
# Use env to clear all host environment variables.
sudo $NSENTER --target $PID --mount --uts --ipc你只要运行一个用于启动应用及其依赖的脚本 --net --pid env -i $@
fi
fi
}
samba搭建
https://github.com/dperson/samba
http://blog.csdn.net/technofiend/article/details/51066262
docker run -dit --name samba -p 139:139 -p 445:445 -v /home:/mount dperson/samba -u "www;overkill" -s "www;/mount/;yes;no;no;all;none"
docker run -it --name samba -p 139:139 -p 445:445 -v /home/barry/share:/mount -d dperson/samba
docker run -dit --name samba -p 139:139 -p 445:445 -v /home:/mount -v /etc/passwd:/etc/passwd -v /etc/group:/etc/group a73dc116f9f9 -s "www;/mount/;yes;no;no;all;none"
smb://192.168.101.237/ubuntu/
http://blog.csdn.net/u013636377/article/details/50780932
registry:2
docker run -d -p 5000:5000 --restart=always --name registry registry:2
sudo /etc/init.d/networking restart
# docker run -d -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v /opt/data/registry:/tmp/registry -p 5000:5000 registry
用主机名访问:docker pull barry:5000/ubuntu
How to create a self-signed SSL Certificate
Generate a Private Key
openssl genrsa -des3 -out server.key 1024
http://localhost:5sudo /etc/init.d/networking restart000/v2/_catalog
docker -H unix:///var/run/docker.sock --insecure-registry 192.168.101.237:5000 run -d -p 5000:5000 --restart=always --name registry -v `pwd`/data:/var/lib/registry -e SETTINGS_FLAVOR=dev registry:2
--insecure-registry 192.168.101.237:5000
run the registry: docker run -p 5000:5000 -v <HOST_DIR>:/tmp/registry-dev index.tenxcloud.com/docker_library/registry Modify your docker startup line/script: acurl -i 192.168.101.237:5000/v2/_catalogd "-H tcp://127.0.0.1:2375 -H unix:///var/run/你只要运行一个用于启动应用及其依赖的脚本docker.sock --insecure-registry <REGISTRY_HOSTNAME>:5000"
docker run -d -p 5000:5000 --restart=always --name registry \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
registry:2
ssh alex@192.168.200.27
www.ilovedocker.com
h client certificate, do not authenticate
在ubuntu上面让修改的hosts生效
sudo /etc/init.d/networking restart
client安装我们的CA证书:
sudo mkdir -p /etc/docker/certs.d/data.juxinli.com:5000
sudo cp certs/domain.crt /etc/docker/certs.d/data.juxinli.com:5000/ca.crt
docker run --privileged=true -e HOST_IP=192.168.101.237 -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker -v /var/local/apphouse/config:/var/lib/registry_Deploy/install/config -v /var/local/apphouse/storage:/var/lib/registry_Deploy/install/storage index.youruncloud.com/apphouse/apphouse:latest
index.youruncloud.com/apphouse/elasticsearch:v1.0.2.106