Skip to main content

Posts

Showing posts with the label docker

Remote API useful tricks for Docker on Mac OS X

Install Socat Socat allow you to forward ports to a variety of things. For Docker forwarding a port to the docker.sock file makes a quick way to get access to the Docker remote api. Docker also allow a way to open up that TCP port however on Mac it is temperamental and hard to use brew install socat socat -d TCP-LISTEN:2375,reuseaddr,fork UNIX:/var/run/docker.sock & Create an IP alias Running Docker containers locally is a fairly common thing. Interconnectivity between containers works naturally. However, sometimes you may also want a container to connect back to the Docker Remote API. If you are constantly on the go changing networks you do not want to have to change that IP address every time. A great use case for this is running Jenkins and using docker slaves sudo ifconfig lo0 alias 192.168.99.50 Remote API There are also some interesting endpoints you can use for information curl http://localhost:2375 curl http://localhost:2375/containers/json curl http://l...

Docker Compose a Selenium Grid

There are times when you would like to Selenium Grid quickly so that it can scale to whatever testing goal is you want to achieve. To start out you will need to get Docker you can goto Docker.com to find out more information on installing. Create a docker-compose.yml Make a new directory and name a file docker-compose.yml inside that directory. The contents are below. hub: image: selenium/hub ports: - "4444:4444" chrome: image: selenium/node-chrome links: - hub expose: - "5555" firefox: image: selenium/node-firefox links: - hub expose: - "5555" Once you have created your file goto that directory in your command line. This will create your instances and download necessary files. $ docker-compose build To run your instances you can run the following and it will start your servers. $ docker-compose up At this point you can now point your test code to http://127.0.0.1:4444 as the selenium server. You will n...

Crude Ruby Script to ask for a Password to use for Private git Repo

The Intro Good ole Docker. It is a powerful tool to setup your environments whether in production, dev or test. Plowing through and building a new container I discovered I had the need or want to pass an argument to the Dockerfile and let it log me into a private repo. The Environment Variable.  Looking through the Dockerfile documentation on the docker.io website I saw this wonderful looking thing called an environment variable. When I first looked at it I thought that meant that we could pass them in from the host cli running the docker command. I was dead wrong. The environment variable does create a variable but its only for the container's environment. So what does that mean for us. Well if you think about the reason for Docker is for an unattended setup of an environment. Now if I were going to do this completely automated then I would probably create a ssh key and copy it over using Dockerfile. This is not what I wanted. I really wanted a seperation where I didn't...