Dockerのhost環境をbridge modeに設定変更をしました
変更方法は下記の通りです
1. ip addr del 192.168.215.181/24 dev ens33 2. docker network create \ --driver bridge \ --subnet=192.168.215.0/24 \ --gateway=192.168.0.181 \ --opt "com.docker.network.bridge.name"="br0" \ shared_nw 3. brctl addif br0 ens3
上記の通り、br0を作成し、docker hostからinternetへのアクセスを及び、他のホストからdocker hostへのsshが出来ることを確認し、以下のDockerfileをbuildしようとしたのですが、errorになってbuildできません
Dockerfile
1FROM centos:7 2MAINTAINER Admin 3 4RUN yum -y install initscripts MAKEDEV 5RUN yum check 6RUN yum -y update 7RUN yum -y install net-tools 8 9# ansible install 10RUN yum -y install wget 11RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -ivh epel-release-latest-7.noarch.rpm 12 13RUN yum -y install ansible 14 15# ssh install 16RUN yum -y install openssh-server 17RUN sed -ri 's/^#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config 18RUN ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key 19 20RUN echo 'root:password' | chpasswd 21 22EXPOSE 22 23 24CMD ["/usr/sbin/sshd", "-D"]
build error
docker build -t ansible-docker:1.1 . Sending build context to Docker daemon 2.56kB Step 1/17 : FROM centos:7 ---> e934aafc2206 Step 2/17 : MAINTAINER Admin <testuya.saito@ntt.com> ---> Using cache ---> 6b33ecb34d48 Step 3/17 : RUN echo 'nameserver 8.8.8.8' >> /etc/resolv.conf ---> Using cache ---> 9075f4007389 Step 4/17 : RUN yum -y install initscripts MAKEDEV ---> Running in 7f64a271a571 Loaded plugins: fastestmirror, ovl One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled yum --disablerepo=<repoid> ... 4. Disable the repository permanently, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable <repoid> or subscription-manager repos --disable=<repoid> 5. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true Cannot find a valid baseurl for repo: base/7/x86_64 Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" The command '/bin/sh -c yum -y install initscripts MAKEDEV' returned a non-zero code: 1
上記のerrorの内容から、containerからyumに関するRepositoryの名前解決が出来ないのかと考え、下記の方法を試してみました
対策
/usr/lib/systemd/system/docker.serviceの
ExecStart=/usr/bin/dockerd -D --dns=8.8.8.8
結果としては、上記と同じerrorになり、Docker buildが出来ませんでした
このような状況なのですが、Docker hostのネットワーク環境をbrige modeした場合、どのように対応すれば、docker buildができるのでしょうか
識者の皆様、ご指導よろしくお願いします
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/31 00:12