File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ To set custome IP address range to your container in docker
2+
3+ sudo vim /etc/default/docker
4+ add this line to file
5+
6+ DOCKER_OPTS="--bip=10.66.33.10/24"
7+ then reboot
8+ after reboot start a container
9+
10+ docker run -it --name t2 jangorecki/r-base-dev /bin/bash
11+ and check ip of a container
12+
13+ docker inspect --format '{{ .NetworkSettings.IPAddress }}' t2
14+
15+
16+ OR
17+
18+ docker exec -it c1 bash -c "echo -e 'IPADDR=172.17.0.4 \n HOSTNAME=c1' >> /etc/sysconfig/network-scripts/ifcfg-eth0; /etc/init.d/network restart";
19+
20+
21+ OR - to change the IP address of this docker container
22+
23+ You will have to first detach the container from the custom network and the connect it back by providing the ip.
24+
25+ You can follow the following steps :
26+
27+ docker network disconnect [OPTIONS] NETWORK CONTAINER
28+ docker network connect --ip 192.168.150.3 NETWORK CONTAINER
You can’t perform that action at this time.
0 commit comments