[关闭]
@bergus 2016-07-15T18:42:05.000000Z 字数 4062 阅读 1640

服务器

服务器


base ubuntu

  1. docker run -d -p 0.0.0.0:2222:22 tutum/ubuntu:trusty
  2. docker run -d -p 2222:22 -e ROOT_PASS="mypass" tutum/ubuntu:trusty
  3. docker run -d -p 2222:22 -e AUTHORIZED_KEYS="cat ~/.ssh/id_rsa.pub" tutum/ubunt

进入容器内部快捷的方法。在家目录创建一个.bashrc_docker文件,内容如下:

  1. # Some useful commands to use docker.
  2. # Author: yeasy@github
  3. # Created:2014-09-25
  4. alias docker-pid="sudo docker inspect --format '{{.State.Pid}}'"
  5. alias d你只要运行一个用于启动应用及其依赖的脚本ocker-ip="sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
  6. #the implementation refs from https://github.com/jpetazzo/nsenter/blob/master/docker-enter
  7. function docker-enter() {
  8. #if [ -e $(dirname "$0")/nsenter ]; then
  9. #Change for centos bash running
  10. if [ -e $(dirname '$0')/nsenter ]; then
  11. # with boot2docker, nsenter is not in the PATH but it is in the same folder
  12. NSENTER=$(dirname "$0")/nsenter
  13. else
  14. # if nsenter has already been installed with path notified, here will be clarified
  15. NSENTER=$(which nsenter)
  16. #NSENTER=nsenter
  17. fi
  18. [ -z "$NSENTER" ] && echo "WARN Cannot find nsenter" && return
  19. if [ -z "$1" ]; then
  20. echo "Usage: `basename "$0"` CONTAINER [COMMAND [ARG]...]"
  21. echo ""
  22. echo "Enters the Docker CONTAINER and executes the specified COMMAND."
  23. echo "If COMMAND is not specified, runs an interactive shell in CONTAINER."
  24. else
  25. PID=$(sudo docker inspect --format "{{.State.Pid}}" "$1")
  26. if [ -z "$PID" ]; then
  27. echo "WARN Cannot find the given container"
  28. return
  29. fi
  30. shift
  31. OPTS="--target $PID --mount --uts --ipc --net --pid"
  32. if [ -z "$1" ]; then
  33. # No command given.
  34. # Use su to clear all host environment variables except for TERM,
  35. # initialize the environment variables HOME, SHELL, USER, LOGNAME, PATH,
  36. # and start a login shell.
  37. #sudo $NSENTER "$OPTS" su - root
  38. sudo $NSENTER --target $PID --mount --uts --ipc --net --pid su - root
  39. else 你只要运行一个用于启动应用及其依赖的脚本
  40. # Use env to clear all host environment variables.
  41. sudo $NSENTER --target $PID --mount --uts --ipc你只要运行一个用于启动应用及其依赖的脚本 --net --pid env -i $@
  42. fi
  43. fi
  44. }

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"

  1. docker run -it --name samba -p 139:139 -p 445:445 -v /home/barry/share:/mount -d dperson/samba
  2. 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

  1. docker run -d -p 5000:5000 --restart=always --name registry registry:2
  2. sudo /etc/init.d/networking restart
  3. # docker run -d -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v /opt/data/registry:/tmp/registry -p 5000:5000 registry
  4. 用主机名访问:docker pull barry:5000/ubuntu
  5. How to create a self-signed SSL Certificate
  6. Generate a Private Key
  7. openssl genrsa -des3 -out server.key 1024
  8. http://localhost:5sudo /etc/init.d/networking restart000/v2/_catalog
  9. 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
  10. --insecure-registry 192.168.101.237:5000
  11. 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"
  12. docker run -d -p 5000:5000 --restart=always --name registry \
  13. -v `pwd`/certs:/certs \
  14. -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
  15. -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
  16. registry:2
  17. 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

  1. 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

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-docker-registry-on-ubuntu-14-04

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注