Docker部署

Debian Linux

# 下载
wget 'https://download.docker.com/linux/debian/dists/jessie/pool/stable/amd64/docker-ce_17.12.0~ce-0~debian_amd64.deb'
wget 'http://mirrors.ustc.edu.cn/docker-ce/linux/debian/dists/jessie/pool/stable/amd64/docker-ce_17.12.1~ce-0~debian_amd64.deb'

# 安装
dpkg -i xxx.deb

# 可能需要
apt-get -f install

# 测试
docker run hello-world

# 卸载

#register帐号配置

mkdir -p /data/docker-registry/auth
docker run --rm --entrypoint htpasswd registry:2 -Bbn user pass >> /data/docker-registry/auth/htpasswd

register

docker run -d \
	-p 5000:5000 \
	--restart always \
	--name registry \
	-v /data-0/docker-registry:/var/lib/registry \
	-v /data-0/docker-registry/config.yml:/etc/docker/registry/config.yml \
	registry
	
docker run -d \
  -p 127.0.0.1:5000:5000 \
  --restart=always \
  --name registry \
  -v /data/docker-registry/auth:/auth \
  -v /data/docker-registry/registry:/var/lib/registry \
  -e "REGISTRY_AUTH=htpasswd" \
  -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
  -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
  registry:2

register登陆

docker login myregistrydomain.com:5000

registry config.yml

version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /var/lib/registry
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3
auth:
  htpasswd:
    realm: basic-realm
    path: /var/lib/registry/htpasswd

web管理

docker run -d --restart always -p 127.0.0.1:9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /data/docker-portainer:/data --name portainer portainer/portainer

gogs

docker run -d --restart always --name=gogs -p 127.0.0.1:10080:3000 -v /data/docker-gogs:/data gogs/gogs:0.11.34