LoginSignup
10
9

More than 5 years have passed since last update.

最近のUbuntu(15.04以降)でDockerの--insecure-registryの設定

Last updated at Posted at 2016-08-09

systemd が導入されて以降の Ubuntu (15.04以降) で、Dockerのプライベートレジストリを立てる時の--insecure-registryの設定方法

やりたいことは(HTTPSじゃなくて)素のHTTPでプライベートレジストリを立るってこと。
Dockerはじめたばかりで、Ubuntuもそんなに触らないので、調べながらやってたら、思いの外はまったので、まとめてきます。

ネタ元

結局は、以下のブログ記事の内容で、できました。
Changing the Docker daemon options in systemd on Ubuntu 15.04

設定ファイル

以下の設定ファイル

[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --insecure-registry=myreg.example.com:5000

を、次のいずれかの方法で配置する。
myreg.example.comは、適宜、変更のこと。)

手で配置

上記ファイルを/etc/systemd/system/docker.service.d/下に設定ファイルを置く。
(ファイル名などの習慣は、よく知らない...)

systemctlを使う

あるいは、以下のコマンド

$ sudo systemctl edit docker

で立ち上がったエディタを使って打ち込み、保存、エディタを抜ける。
(ちなみに、上記ディレクトリにはoverride.confというファイルができた。)

Dockerの再起動

設定ファイル配置のあと、Dockerサービスを再起動する。

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

リファレンス

https://github.com/docker/docker/issues/23228
本家のバグ報告。
「それsystemdだから」「できた」で解決済みになってる。

https://docs.docker.com/engine/admin/systemd/
本家サイトの systemd 対応文書。
分かってから読むと、こういうことが書いてあったんだなと思う(けど、初見では難しいな)

http://docs.docker.jp/engine/articles/systemd.html
Docker ドキュメント日本語化プロジェクトのsystemdのページ。

【Docker】プライベートレジストリ--insecure-registryOSごと設定まとめ
いろんなOSごとの設定まとめ。
Docker for Macでもはまったので、助かった。

10
9
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
10
9