Skip to content
Rodrigo edited this page Sep 27, 2019 · 6 revisions

Welcome to the docker-vagrant wiki! ✏️ 📚

The aim of this wiki is show the most common tasks used on Docker 🐳.

All you need, is running Vagrant with Docker and Internet connection. Another way to get Docker, is Play With Docker (you need a Docker Hub account to be able to login).

If everything was fine, login via SSH:

vagrant ssh

Internal & External IP

💡 Throughout wiki, there are examples in which we expose ports outside. We can use localhost or a Web browser (Firefox, Google Chrome, Edge). So that, we need to know what IPs are assigned to Vagrant.

  • Internal
vagrant@vagrant:~$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 08:00:27:6b:c1:df  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe6b:c1df/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:81852 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11370 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:72949126 (72.9 MB)  TX bytes:825259 (825.2 KB)
  • External
vagrant@vagrant:~$ ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 08:00:27:a4:ab:87  
          inet addr:192.168.0.43  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fea4:ab87/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:162 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15675 (15.6 KB)  TX bytes:7218 (7.2 KB)

Example with NGINX

Run NGINX container

vagrant@vagrant:~$ docker container run --name nginx -p 8080:80 -d nginx
821168800b370b9bb9f15070fd1a1c36f720e228371690fca7273a1ddbd57d6b
  • Localhost
vagrant@vagrant:~$ curl localhost:8080
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
  • Web browser

Clone this wiki locally