I am currently using Docker to run a Debian build environment with a separate
nginx
container for a local apt repository
(with both containers sharing a data-only container). At the moment there is no functionality in Docker to add a static ip address. It is expected to arrive in docker 1.7
viadocker/libnetwork - see also the Docker Blog. In the meantime the following works:- Setup your own bridge (e.g
br0
) - Start
docker
with:-b=br0
- Install pipework
- Install
arping
default gateway
ip address of 192.168.1.1
:You will no longer be able to useBASH CODEsudo bash -c "curl https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework > /usr/local/bin/pipework" sudo chmod +x /usr/local/bin/pipework sudo pipework br0 container-name 192.168.1.100/24@192.168.1.1
docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$@"
to find the containers ip address.
A script to create
docker
data-only containers + a container with an optional static ip address. If the script is re-run to create a container-name
that already exists - it will optionally create container-name2
then container-name3
etc...
- The Old Way (pre v 1.0) -
http://shellfu.com/2014/11/docker-assigning-static-ip-addresses-to-containers/
No comments:
Post a Comment