This is not a complete article - it’s a post with docker essential tips which you have to know if you want to run some of your apps within a docker enviroment. I’m going to update this article when I learn this system better. These are my first steps and I’ll use my article as a reminder in the future.
Docker installation
Docker still dosn’t have full support in mac os. Of course they have [Boot2Docker][2], but it’s docker lauched within a VM. So, I prefer to use my own VM running in VirtualBox on another machine. In order to do so, I use ubuntu. Installation on ubuntu linux looks as follows:
or you can use ubuntu repository:
If you see an error like this:
you just need to reboot a server.
Build your own container
To build you own container, you need to have Dockerfile
. Go to the folder where your docker file is located. And execute this command:
Useful parameters:
-no-cache
- builds container avoiding cached steps.
Run container
After a container building process, you can launch it. The command could be like this:
Useful parameters:
-d
- runs container in the background-p [container port]:[host port]
- opens the exposed port on an host machine--link [name or id]:[alias]
- allows a container to access another container speicified by[name or id]
-v [host path]:[container path]
- for external volume linking--restart="always"
- restarts your container after a failure or a system reboot
UPD: May 25, 2015