0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

proxy環境下におけるDockerの使い方

Last updated at Posted at 2024-08-21

Proxy環境下におけるDockerの使い方

dockerdのproxy対応

sudo systemctl edit docker

[Service]
Environment="HTTP_PROXY=http://your_proxy"
Environment="HTTPS_PROXY=http://your_proxy"

Dockerクライアントのproxy対応

~/.docker/config.json
{
  "proxies": {
    "default": {
      "httpProxy": "http://your_proxy",
      "httpsProxy": "http://your_proxy"
    }
  }
}

補足

環境変数として渡せばいいので以下のやり方でも可能

docker-compose.yml
services:
  app:
    build:
      context: .
      dockerfile: ./docker/php/Dockerfile
      args:
        http_proxy: http://your_proxy
        https_proxy: http://your_proxy
    environment:
      http_proxy: http://your_proxy
      https_proxy: http://your_proxy
      no_proxy: "localhost,127.0.0.1"
    tty: true
  • args
    buildプロセスでproxyを使う場合
  • environment
    コンテナプロセス内でproxyを使う場合
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?