Code: Select all
docker: Error response from daemon: network eth0.0 not found.
How can I accomplish this?
Thanks!
Code: Select all
docker: Error response from daemon: network eth0.0 not found.
Code: Select all
#!/bin/sh
# Get IPv4 for Gateway, Subnet Mask and IP Addresses
while [ -z "$ip4" ]
do
ip4="$(ip -o -4 addr list eth0 | awk '{print $4}' | cut -d. -f1,2,3)"
done
# Stop running containers
docker kill alpine1
docker kill alpine2
docker kill alpine3
# Remove containers
docker rm alpine1
docker rm alpine2
docker rm alpine3
# Remove docker network
docker network rm eth0
# Create docker network
docker network create -d macvlan --subnet="$ip4.0/24" --gateway="$ip4.1" -o parent=eth0 -o macvlan_mode=bridge eth0
# Start dockers
docker run -d --name='alpine1' --net='eth0' --ip="$ip4.101" 'alpine' tail -f /dev/null
docker run -d --name='alpine2' --net='eth0' --ip="$ip4.102" 'alpine' tail -f /dev/null
docker run -d --name='alpine3' --net='eth0' --ip="$ip4.103" 'alpine' tail -f /dev/null
Code: Select all
docker exec -ti alpine# /bin/sh
Docker (and SDN in general) is not friendly with DHCP and its broadcasts.edgararroyo wrote: ↑Thu Sep 12, 2019 3:00 pmNow my hurdle is making these interfaces get IP, gateway, subnet and dns via DHCP, but there is no plugin yet. Need DHCP because this only works if the subnet is 0/24 and gateway is 1 and IP addresses 101 thru 103 are not being used.
Ok thanks. I started using macvlan but never got to using pipework because I decided to use macvlan on docker LOLepoch1970 wrote: ↑Sat Sep 14, 2019 5:40 pmmanual macvlan creation + networking=none + pipework will work with DHCP.
To assign IPs from the network you need the IP parameters but also to have some authority on it. Otherwise one day you might assign an address that is reserved to some special use, and the firewall will block or an alarm will ring somewhere...
Code: Select all
ip link add link eth0 name eth1 address xx:xx:xx:xx:xx:xx type macvlan