CentOS / sig-cloud-instance-images

CentOS cloud images
777 stars 559 forks source link

CentOS7 purge leftover ifcfg-x files from docker image #56

Closed fbladilo closed 8 years ago

fbladilo commented 8 years ago

It would be nice to purge leftover ifcfg-x files from the docker image, it causes issues specially with systemd enabled containers using centos7 as a base. Below is an example along with systemd failing to start the network.service because of a bogus ifcfg-ens2 already baked in the centos7 image :

[root@0ea52bb network-scripts]# cat ifcfg-ens2 TYPE=Ethernet BOOTPROTO=dhcp DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=ens2 UUID=d7d058b5-723e-4776-b332-af376d635b9f DEVICE=ens2 ONBOOT=yes PEERDNS=yes PEERROUTES=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes

[root@0ea52bb network-scripts]# systemctl status network ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network) Active: failed (Result: exit-code) since Mon 2016-05-16 20:33:34 UTC; 13min ago Docs: man:systemd-sysv-generator(8)

May 16 20:33:32 0ea52bbb78f1 systemd[1]: Starting LSB: Bring up/down networking... May 16 20:33:33 0ea52bbb78f1 network[79]: Bringing up loopback interface: [ OK ] May 16 20:33:33 0ea52bbb78f1 network[79]: Bringing up interface ens2: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device ens2 does not seem to be present, delaying initialization. May 16 20:33:33 0ea52bbb78f1 network[79]: [FAILED] May 16 20:33:34 0ea52bbb78f1 systemd[1]: network.service: control process exited, code=exited status=1 May 16 20:33:34 0ea52bbb78f1 systemd[1]: Failed to start LSB: Bring up/down networking. May 16 20:33:34 0ea52bbb78f1 systemd[1]: Unit network.service entered failed state. May 16 20:33:34 0ea52bbb78f1 systemd[1]: network.service failed.

fbladilo commented 8 years ago

Any takers?

jperrin commented 8 years ago

This is done in the latest and 7 tags. The other tags:

$ docker run --rm -it centos
[root@67e760754286 /]# cd /etc/sysconfig/network-scripts/
[root@67e760754286 network-scripts]# ls
[root@67e760754286 network-scripts]# ll -a
total 0
fbladilo commented 8 years ago

@jperrin :+1: will give them a shot

sunyq commented 4 years ago

Hi, how to change the default NIC name in centos-7 containers since ifcfg-x files have been purged from the base image?