I started with this guide from Digital Ocean. I already had a configured instance of Ubuntu 14.04, and began by downloading docker and running the install script:
wget -qO- https://get.docker.com/ | sh
Next add your user to the 'docker' group, in my case I was logged in under the default 'ubuntu' user account:
sudo usermod -aG docker ubuntu
sudo apt-get -y install python-pip
Install 'docker-compose' via 'pip':
sudo pip install docker-compose
Create a docker directory, enter into it, and create a filed called docker-compose.yml which will be the configuration file for our test container:
ubuntu ~ $ mkdir docker ubuntu ~ $ cd docker/ ubuntu ~/docker $ vim docker-compose.yml ubuntu ~/docker $ cat docker-compose.yml my-test: image: hello-world ubuntu ~/docker $ docker-compose up -d ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
If you run into the 'Couldn't connect to Docker daemon' error as seen above, ensure you have added your current user to the 'docker' group (see Step 2), and make sure to log out of your terminal prompt and log back in in order for 'usermod' change to take effect. Then retry the command (the -d flag allows the 'docker-compose' command to run in the background):
ubuntu ~/docker $ docker-compose up -d Creating docker_my-test_1 ubuntu ~/docker $ docker-compose ps Name Command State Ports ------------------------------------------- docker_my-test_1 /hello Exit 0
Now that we have successfully launched the test 'hello-world' container, and checked it's status with the 'docker-compose ps' command, we can move on to working with more containers from the official Docker Repositories.
Knowledge Base is a repository for various notes, guides, and thoughts on a wide range of IT related topics. Read more...
Web development services by Say Web Solutions. Visit website.