DevOps

Docker 1.13 Management Commands

Docker 1.13 was released yesterday, congratulations!

A quick summary of the key features:

  • Compose file to deploy Swarm mode services
  • Improved CLI backwards compatibility
  • Clean-up commands
  • CLI restructured
  • Monitoring and Build improvements

Learn more details about these features in this video by @manomarks:
 
 

Getting Started with Docker 1.13

Use Docker for Mac or Windows to get started. Once installed, the version information looks like:

Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      darwin/amd64
 
Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      linux/amd64
 Experimental: true

Problems with Docker CLI

Docker 1.12 CLI has about ~40 top-level solo commands. While these commands wokred very well but they had a few issues:

  1. The commands are listed in one list without any organization. That makes it difficult for newbies to get started and learn the commands. (#8756)
  2. The command, such as docker inspect, also does not provide enough context whether they are operating on image or container. This mixing of image and container commands can cause confusion. (#13509)
  3. There is no consistency of command names. For example docker images is a plural and gives the list of images where as docker ps is singular and gives the list of containers. And they of course have the naming inconsistency issue. (#8829)
  4. Some of the commands like build and run are used heavily and then some arcane ones like pause and wait not so often. It does not seem fair to keep all the commands at the same level.

Docker 1.13 fixes this problem!

Docker Management Commands

Docker 1.13 groups the commands logically into management commands.

Here are the top-level solo commands now:

checkpoint  Manage checkpoints
container   Manage containers
image       Manage images
network     Manage networks
node        Manage Swarm nodes
plugin      Manage plugins
secret      Manage Docker secrets
service     Manage services
stack       Manage Docker stacks
swarm       Manage Swarm
system      Manage Docker
volume      Manage volumes

Now a list of images is obtained using docker image ls command instead of docker images command. Similar docker container lsshows the list of containers instead of docker ls. This brings a lot of consistency across the commands and that would make it intuitive and easier for newbie and pros to remember the commands.

Each management command has some similar set of sub-commands where they perform the operation on the command category:

SUB-COMMANDPURPOSE
lsList <category> (image, container, volume, secret, etc)
rmRemove <category>
inspectInspect <category>

And there are other sub-commands based upon the management category.

Some of the heavily used commands are still at the top level.

By default, all the top-level commands are also shown. But you can set the DOCKER_HIDE_LEGACY_COMMANDS environment variable to show only the management commands. So even though docker --help will show all the solo and management commands. But the following commands will only show the new management commands:

DOCKER_HIDE_LEGACY_COMMANDS=true docker --help

The old syntax is still supported but it recommended to start moving to new commands.

A new Couchbase container can be started as:

 docker container run -d -p 8091-8094:8091-8094 -p 11210:11210 arungupta/couchbase

The list of images can be seen as:

docker image ls

Mapping Docker Solo to Management Commands

Let’s look at how the existing top-level commands match to the management commands:

1.121.13Purpose
attach container attachAttach to a running container
build image buildBuild an image from a Dockerfile
commit container commitCreate a new image from a container’s changes
cpcontainer cpCopy files/folders between a container and the local filesystem
create container commitCreate a new container
diff container diffInspect changes on a container’s filesystem
events system eventsGet real time events from the server
exec container execRun a command in a running container
export container exportExport a container’s filesystem as a tar archive
history image historyShow the history of an image
imagesimage lsList images
import image importImport the contents from a tarball to create a filesystem image
info system infoDisplay system-wide information
inspect container inspectReturn low-level information on a container, image or task
kill container killKill one or more running containers
load image loadLoad an image from a tar archive or STDIN
login loginLog in to a Docker registry.
logout logoutLog out from a Docker registry.
logs container logsFetch the logs of a container
network networkManage Docker networks
node nodeManage Docker Swarm nodes
pause container pausePause all processes within one or more containers
port container portList port mappings or a specific mapping for the container
ps container lsList containers
pull image pullPull an image or a repository from a registry
push image pushPush an image or a repository to a registry
rename container renameRename a container
restart container restartRestart a container
rm container rmRemove one or more containers
rmi image rmRemove one or more images
run container runRun a command in a new container
save image saveSave one or more images to a tar archive (streamed to STDOUT by default)
search searchSearch the Docker Hub for images
service serviceManage Docker services
start container startStart one or more stopped containers
stats container statsDisplay a live stream of container(s) resource usage statistics
stop container stopStop one or more running containers
swarm swarmManage Docker Swarm
tag image tagTag an image into a repository
top container topDisplay the running processes of a container
unpause container unpauseUnpause all processes within one or more containers
update container updateUpdate configuration of one or more containers
version versionShow the Docker version information
volume volumeManage Docker volumes
wait container waitBlock until a container stops, then print its exit code

Sign up for Docker Online Meetup on 1/25 at 10am PST for more details on Docker 1.13.

Use Docker for Mac or Windows to get started with Docker 1.13.

And of course, you can learn more about how to run Couchbase on Containers.

Related posts:

  1. Docker Common Commands Cheatsheet (Tech Tip #59)
  2. Docker 1.7.0, Docker Machine 0.3.0, Docker Compose 1.3.0, Docker Swarm 0.3.0
  3. Couchbase Cluster on Docker Swarm using Docker Compose and Docker Machine
  4. Docker Tools in Eclipse
  5. Docker 1.6 released – Docker Machine 0.2.0 (Tech Tip #84)
Reference: Docker 1.13 Management Commands from our JCG partner Arun Gupta at the Miles to go 3.0 … blog.

Arun Gupta

Arun is a technology enthusiast, avid runner, author of a best-selling book, globe trotter, a community guy, Java Champion, JavaOne Rockstar, JUG Leader, Minecraft Modder, Devoxx4Kids-er, and a Red Hatter.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button