As a Mac user, Docker comes in as boot2docker. I don’t quite like using that interface; I prefer having a simple Ubuntu VM on my Vagrant environment where I can manage my containers from a pre-installed Docker. I like this arrangement because it allows me to keep updated on Vagrant, which is more useful for various environments and providers: VirtualBox, VMware, Docker, and Hyper-V. I chose Jenkins for this example:
At the end of the line, I have a default Jenkins container running and publishing on port 8080. To be able to see it from my Mac browser, I need to forward ports from the Vagrantfile
(8080 to 80) and then Nginx (80 to 8080):
http://localhost:8080
» ubuntu:80
» jenkins:8080
Vagrantfile Configuration Link to heading
config.vm.network "forwarded_port", host: 8080, guest: 80, auto_correct: true
Ubuntu Link to heading
apt-get -y install docker nginx
docker rm jenkins1
docker run -d -p 8080:8080 --name=jenkins1 jenkins
docker inspect jenkins1 | grep IPAddress
Nginx Configuration in Ubuntu Link to heading
wget https://gist.githubusercontent.com/carlessanagustin/f34db6dc45e376029682/raw/0622f8f375d4ba68e49350dc941198345c52bbe6/nginx-reverse-proxy.conf
cp nginx-reverse-proxy.conf /etc/nginx/sites-enabled/jenkins
service nginx restart
(Replace server IP from nginx-reverse-proxy.conf
)