I am trying to rename the network interfaces inside a docker container.

Right now they are eth0, eth1, eth2, etc. I would like them to have different names. I know how to do it in Ubuntu with modifying the 70-persistent-rules file, but that file seems to be missing.

I had to use docker commands to change the ip addresses, so I was wondering if there was a docker command for this as well. The docker container I am using is an ubuntu 14.04

Thanks in advance!


I found the answer to my own question.

I ran my container in privileged mode with the below command:

docker run -i -t \
    --name #NAME# \
    --privileged \
    -v /var/run/docker.sock:/host/var/run/docker.sock \
    -v /dev:/host/dev \
    -v /proc:/host/proc:ro \
    -v /boot:/host/boot:ro \
    -v /lib/modules:/host/lib/modules:ro \
    -v /usr:/host/usr:ro container:latest

Replace #NAME# with what you want the name to be and replace container:latest with your container.

With this, I was able to change the ip address name with ifconfig.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.