Actually, it's a guide to setup docker macvlan network and it can be used to attach static ip to container on public/local network.
- Create docker public network:
docker network create -d macvlan --subnet=$SUBNET --gateway=$GATEWAY_IP -o parent=eth0 public
Where:
$SUBNET - your public network subnet
$GATEWAY_IP - your public network gateway
parent=eth0 - interface on machine which belongs to this public network
- Run/create container :
docker run -dti --net public --ip $PUBLIC_IP --mac-address $MAC_ADDR ubuntu