I installed boot2docker as explained on the docker website. Here are some command runs to show that I have things installed correctly:
$$:~ kv$ boot2docker start Waiting for VM and Docker daemon to start... ...................ooo Started. Writing /Users/kvantum/.boot2docker/certs/boot2docker-vm/ca.pem Writing /Users/kvantum/.boot2docker/certs/boot2docker-vm/cert.pem Writing /Users/kvantum/.boot2docker/certs/boot2docker-vm/key.pem Your environment variables are already set correctly. $$:~ kv$ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ubuntu 14.04 b39b81afc8ca 11 days ago 188.3 MB hello-world latest e45a5af57b00 3 weeks ago 910 B
After this, I ran the following command:
docker run -t -i ubuntu:14.04 /bin/bash
Inside the container, I installed zeromq, and started a zeromq server on port 5555 using tcp.
My questions are following:
If I exit out of the container, will it save all the work I do inside it?
I have no idea how to connect to the server running on port 5555. I read something about exposing a port, but I am not sure how to go about doing that. I did an ifconfig inside the container, and tried to connect to the server from the host like this:
$$:~ kv$ ./zmq_client tcp://container_ip:5555
This did not work. Can someone please lists the steps I need to take in order to connect to the server running within the container.
For completion sake, I am providing the list of my environment variables:
TERM_PROGRAM=Apple_Terminal TERM=xterm-256color SHELL=/bin/bash TMPDIR=/var/folders/km/5kbpdx4s7cg4rmyc6d5q9l9r0000gq/T/ DOCKER_HOST=tcp://192.168.109.103:2376 Apple_PubSub_Socket_Render=/tmp/launch-1tWMHJ/Render TERM_PROGRAM_VERSION=326 OLDPWD=/Users TERM_SESSION_ID=262CBC8B-0A74-4B70-9F28-D9FA51FF713C USER=kv SSH_AUTH_SOCK=/tmp/launch-ZTWNGL/Listeners __CF_USER_TEXT_ENCODING=0x1F7:0:0 DOCKER_TLS_VERIFY=1 __CHECKFIX1436934=1 PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin PWD=/Users/kv DOCKER_CERT_PATH=/Users/kv/.boot2docker/certs/boot2docker-vm HOME=/Users/kv SHLVL=1 LOGNAME=kv LC_CTYPE=UTF-8 DISPLAY=/tmp/launch-rco9zt/org.macosforge.xquartz:0 _=/usr/bin/env
One last question I have is about code performance. So within my Mac OS X, I have a docker container running (which runs Ubuntu). If I run the application, like a zeromq based server inside the container, will it not be slower as compared to running it on Mac OS X directly. Please explain the benefits of using docker in such a scenario…