Docker 1.13 is out and there are some new interesting features which are really useful to DevOps as well as Application Developers.
One huge feature they've rolled out is "docker stack" wherein you can configure all your services into a single configuration file. This was already there before for running containers using docker-compose. The main difference is that "docker stack" is for deployment of services to a Swarm cluster. Configuration is done in a single yaml file.
You can use this sample yml file to try out docker stack
In the yaml file, you can define all the services you would like to run as well as the replica configuration you require for each service. In the same configuration, you can also define which network you would want to run the service.
To run, just save the file as mystack.yml and execute this in the terminal:
$docker stack deploy -c mystack.yml mystack
After executing, you will see something like this.
To check if stack is created and services are running, you can execute:
$docker stack lsand
$docker service ls
Networks are also automatically created if not yet existing
To check if the sample application is running, you can access
You can also check the Swarm visualizer. Currently, I am using my Mac and just running a single node cluster. The visualization would be more interesting if you are running many nodes.
The visualizer in the example is running in
To remove the entire stack, it is just one command!
$docker stack rm mystack
After executing, it stops instances of all services in the stack.
Previously it was difficult to check how much disk space is consumed by docker. Now, there is a easier way to do it:
$docker system df
$docker system prunecan purge all stopped containers, volumes not used, networks not used and dangling images.
Docker Service Logs
Another interesting feature which is very useful for application developers is "docker service logs"
$docker service logs <service name>
If you noticed, the command is consolidating the logs from the 2 running containers. This is really very useful when you need to investigate an issue. You can also send logs to ElasticSearch via FileBeat and this even makes it easier!
This is experimental for now but is already available in 1.13 so you can play around with it.
These commands are now available in 1.13. Docker is now grouping commands based on the object it’s interacting with.
$docker container list/
$docker container start
$docker image history
It was a very good update from Docker and we look forward to more on the next release!
Feel free to leave a comment below.