Mastering Docker, Chapter 4: Managing Containers

The Docker commands

The author wants to spend the next section going over the command line tools that can be used to help troubleshoot containers.  

docker attach

Using this command will connect to the running machine's standard input (STDIN).

docker diff

Shows the changes made to a container.  Similar to git's diff command 

docker exec

Allows us to run commands against a container with connecting to it (via ssh).
  • -i: runs the commands and shows us the output thereof
  • -d: runs the command as a daemon, and doesn't show the output

docker history

The history command gives us a detailed list of all the commands that have been on a container. 

docker inspect

Shows the following information:
  • When the container was created
  • whether the container is using any volumes
  • network settings established
  • architecture used
  • operating system running on the container

docker logs

Shows has been happening since the container was started.  The -f option will show what is happening on the container right now.

docker ps

  • -a: shows all containers
  • -l: will give the latest created containers
  • -n=: will show the last n created containers

docker stats

This will give the running stats on your container

docker top

Shows the commands that currently being run on your container

Using your existing management suite

The next section will show some uses of
And how you cna use them to manage containers

Puppet

You can include Docker in your manifest and then use Puppet to install and run containers

Chef

With Chef's concept of recipes, the possibilities are endless with what you can accomplish with Docker and Chef

Ansible

Ansible can do the same things as the other listed above. 

SaltStack

SaltStack can also be used in the same ways as the other ones to start, stop, and create containers

Docker Swarm

The author promises a brief overview of Docker Swarm, and some uses for it.

What is Docker Swarm?

Docker Swarm allows native clustering of Docker containers.  It also allows management of those containers from a central location.  It can allow you to easily scale up and down as necessary

What Can Docker Swarm do?

It allows discovery to be set up, this will discover new nodes as they are created, and will allow the correct services to be added to the nodes as needed.  Swarm also allows advanced scheduling of jobs.  There are three ranks:
  • spread
  • binpack
  • random
The first two choose based on CPU and RAM, while the last one does exactly what you think.

Further Reading

Comments

Popular posts from this blog

Go Programming Blueprints, Chapter 2, Adding User Accounts

Successful Big Game Hunting Chapter 10