docker-1

1、必须是用sudo启动服务,不然报接入拒绝。

sudo usermod -aG docker <username>
还需要推出登录后,重进。

 2、docker使用proxy pull

First, create a systemd drop-in directory for the docker service:

mkdir /etc/systemd/system/docker.service.d

Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

[Service]
Environment="HTTP_PROXY=http://21.21.21.1:3128/"

If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:

Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"

Flush changes:

$ sudo systemctl daemon-reload

Verify that the configuration has been loaded:

$ sudo systemctl show docker --property Environment
Environment=HTTP_PROXY=http://proxy.example.com:80/

Restart Docker:

$ sudo systemctl restart docker



3、添加ubuntu update 代理

在/etc/apt/apt.conf.d目录下新建10proxy文件,如sudo vi /etc/apt/apt.conf.d/10proxy,添加如下代理配置项

Acquire::http::proxy "http://190.50.253.102:3128";

Acquire::https::proxy "https://190.50.253.102:3128";

4、pip proxy配置

在/ubuntu/.pip/文件夹下创建(没有则新建)创建pip.conf文件

配置为

[global]
trusted-host=pypi.python.org
index-url=http://pypi.python.org/simple

proxy=http://proxyIp:port

 5、进入docker

docker run -it haha /bin/bash

 
原文地址:https://www.cnblogs.com/peterinblog/p/7220828.html