😀 Playing with Docker
Docker is a container service where you can have a clean and unified running environment for your applications.
You can launch a service very easily in the same ways. Also you can make your standard docker images to run your application on a specific infrastructures. This eliminates the time to setup the environment so that we can stay focused on developing the application.
Also each docker container is like a sandbox. You can use it to split the running environments so that applications won’t talk to each other unless necessary. This ensures that we can have a higher security setting for our applications.
There are some docker commands that I use often.
docker stop $(docker ps -a -q)# stop all containers
docker rm $(docker ps -a -q)# remove all removeable containers
docker rmi $(docker images -a -q)# remove all images
docker volume ls -qf dangling=true | xargs -r docker volume rm
There might be situations that you want to create docker images on your own. For example the following image helps you run mongodb and set the default username and password.
There are some commands in the Dockerfile that I used often:
kitematic is has a eays-to-use gui interface for you to launch your docker containers in no time. Which is very impressive.
This is a simple repo that I created for you to start 1 container of node.js process and 1 container of mongodb process and make the node.js container talk to the mongodb container.
What it is doing is it will build two images based on the two dockerfiles and make one docker container talk to the other. All you need to do is install docker-compose and do
$ docker-compose up
to start the 2 containers.
20 Mar 2017