How to use this box with Vagrant:
Vagrant.configure("2") do |config|
config.vm.box = "yungsang/boot2docker"
end
vagrant init yungsang/boot2docker
vagrant up
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues/1.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues/1.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues/1.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues/1.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues?q=label%3Aknowledge+.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues?q=label%3Aknowledge+.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues?q=label%3Aknowledge+.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues?q=label%3Aknowledge+.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created over 9 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/nsenter+without-TLS
Cf.) https://github.com/YungSang/vagrant-docker-helper
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues?q=label%3Aknowledge+.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ docker exec $(docker ps -l -q) ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
21 root ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
46 root sh
55 root ps
/ # exit
$
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.
This version was created almost 10 years ago.
nsenter and docker-enter (docker-attach)Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/nsenter+without-TLS
Cf.) https://github.com/YungSang/vagrant-docker-helper
/etc/resolv.conf in the VM, please refer to https://github.com/YungSang/boot2docker-vagrant-box/issues?q=label%3Aknowledge+.VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant"
# Or you can use NFS as before
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Uncomment below to use more than one instance at once
# config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
config.vm.provision :docker do |d|
d.pull_images "yungsang/busybox"
d.run "simple-echo",
image: "yungsang/busybox",
args: "-p 8080:8080",
cmd: "nc -p 8080 -l -l -e echo hello world!"
end
config.vm.network :forwarded_port, guest: 8080, host: 8080
end
$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
I made docker-enter script for you to attach a container using nsenter easily.
Cf.) https://github.com/YungSang/docker-attach
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3f38ced897a yungsang/busybox:latest nc -p 8080 -l -l -e 27 minutes ago Up 9 minutes 0.0.0.0:8080->8080/tcp simple-echo
$ vagrant ssh -c 'docker-enter $(docker ps -l -q) ps'
nsenter --target 891 --mount --uts --ipc --net --pid ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
9 root ps
Connection to 127.0.0.1 closed.
$ vagrant ssh -c 'docker-enter $(docker ps -l -q) sh'
nsenter --target 891 --mount --uts --ipc --net --pid
/ # ps
PID USER COMMAND
1 root nc -p 8080 -l -l -e echo hello world!
15 root sh
16 root ps
/ # exit
Connection to 127.0.0.1 closed.
$
Cf.) If you run SSHD in your Docker containers, you're doing it wrong!
I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.