docker build -t webapp .
docker run \
--name=webapp \
-p 8080:80 \
-dt \
webapp
Access your website at http://localhost:8080
Before your run the following commands, make sure you have enabled experimental features of Docker.
To enable experimental features of Docker for macvlan deployments of containers, enter the following commands on your ubuntu docker host:
echo '{"experimental": true}' > /etc/docker/daemon.json
service docker restart
Enter in the following commands to set up your docker network on the same L2 subnet as your docker host sharing the hosts' network interface for bridging packets across the underlay.
Replace network values (172.16.10.X) and network interface label (eth1) for your own L2 subnet and its interface that the docker host resides on.
docker network create -d macvlan \
--subnet=172.16.10.0/24 \
--ip-range=172.16.10.128/25 \
--gateway=172.16.10.1 \
-o parent=eth1 MACv-Net
docker run
--name=webapp
--net=MACv-Net
--ip=172.16.10.199
-dt
webapp
For example, access your website at http://172.16.10.199
Remember to replace with your IP address when testing.