LoginSignup
10
9

More than 5 years have passed since last update.

ネットワークがオフラインのdockerコンテナの作り方

Posted at

オフライン環境でのインストールなどを想定してインターネットに接続されていないコンテナを作成する方法です。
--net noneでデフォルトで指定されるbrideを無効にします。

$ docker network ls
NETWORK ID          NAME                DRIVER
5f087876eced        bridge              bridge
f4dc8e62a5bb        none                null
a68134cd67ee        host                host

$ docker run --net none --rm -i -t centos:centos7 /bin/bash
# ping qiita.com
ping: unknown host qiita.com

なお、インストールデータは-vで持ち込むことができます。

$ docker run -v `pwd`/data:/data --net none --rm -i -t centos:centos7 /bin/bash
# ls /data
get-pip.py
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