1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Dockerのプロキシ設定(CentOS, RHEL)

Posted at

毎度忘れてしまうので、メモ。
社内プロキシ下などでdocker pullするために必要なプロキシの設定です。

CentOS, RHEL7系の場合

  • ディレクトリ作成
$ sudo mkdir -p /usr/lib/systemd/system/docker.service.d
  • ファイル作成&環境変数設定
$ sudo vi /usr/lib/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://user:pass@proxy.domain:port"
Environment="HTTPS_PROXY=http://user:pass@proxy.domain:port"
Environment="NO_PROXY=localhost,127.0.0.1"
  • Docker再起動
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

RHEL8以降の場合

Dockerの代わりにPodmanを使うことが推奨されており、パスが若干違います。
※なお、podmanはdockerコマンドとの互換性があるので、基本的にはDockerと同じように使えます。

  • ディレクトリ作成
$ ls /usr/lib/systemd/system/podman
podman-auto-update.service  podman-auto-update.timer    podman-restart.service      podman.service              podman.socket               
$ sudo mkdir -p /usr/lib/systemd/system/podman.service.d
  • ファイル作成&環境変数設定
$ sudo vi /usr/lib/systemd/system/podman.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://user:pass@proxy.domain:port"
Environment="HTTPS_PROXY=http://user:pass@proxy.domain:port"
Environment="NO_PROXY=localhost,127.0.0.1"
  • Podman再起動
$ sudo systemctl daemon-reload
$ sudo systemctl restart podman
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?