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:
- The commands are listed in one list without any organization. That makes it difficult for newbies to get started and learn the commands. (#8756)
- 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) - There is no consistency of command names. For example
docker images
is a plural and gives the list of images where asdocker ps
is singular and gives the list of containers. And they of course have the naming inconsistency issue. (#8829) - Some of the commands like
build
andrun
are used heavily and then some arcane ones likepause
andwait
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 ls
shows 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-COMMAND | PURPOSE |
---|---|
ls | List <category> (image, container, volume, secret, etc) |
rm | Remove <category> |
inspect | Inspect <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.12 | 1.13 | Purpose |
---|---|---|
attach | container attach | Attach to a running container |
build | image build | Build an image from a Dockerfile |
commit | container commit | Create a new image from a container’s changes |
cp | container cp | Copy files/folders between a container and the local filesystem |
create | container commit | Create a new container |
diff | container diff | Inspect changes on a container’s filesystem |
events | system events | Get real time events from the server |
exec | container exec | Run a command in a running container |
export | container export | Export a container’s filesystem as a tar archive |
history | image history | Show the history of an image |
images | image ls | List images |
import | image import | Import the contents from a tarball to create a filesystem image |
info | system info | Display system-wide information |
inspect | container inspect | Return low-level information on a container, image or task |
kill | container kill | Kill one or more running containers |
load | image load | Load an image from a tar archive or STDIN |
login | login | Log in to a Docker registry. |
logout | logout | Log out from a Docker registry. |
logs | container logs | Fetch the logs of a container |
network | network | Manage Docker networks |
node | node | Manage Docker Swarm nodes |
pause | container pause | Pause all processes within one or more containers |
port | container port | List port mappings or a specific mapping for the container |
ps | container ls | List containers |
pull | image pull | Pull an image or a repository from a registry |
push | image push | Push an image or a repository to a registry |
rename | container rename | Rename a container |
restart | container restart | Restart a container |
rm | container rm | Remove one or more containers |
rmi | image rm | Remove one or more images |
run | container run | Run a command in a new container |
save | image save | Save one or more images to a tar archive (streamed to STDOUT by default) |
search | search | Search the Docker Hub for images |
service | service | Manage Docker services |
start | container start | Start one or more stopped containers |
stats | container stats | Display a live stream of container(s) resource usage statistics |
stop | container stop | Stop one or more running containers |
swarm | swarm | Manage Docker Swarm |
tag | image tag | Tag an image into a repository |
top | container top | Display the running processes of a container |
unpause | container unpause | Unpause all processes within one or more containers |
update | container update | Update configuration of one or more containers |
version | version | Show the Docker version information |
volume | volume | Manage Docker volumes |
wait | container wait | Block 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:
- Docker Common Commands Cheatsheet (Tech Tip #59)
- Docker 1.7.0, Docker Machine 0.3.0, Docker Compose 1.3.0, Docker Swarm 0.3.0
- Couchbase Cluster on Docker Swarm using Docker Compose and Docker Machine
- Docker Tools in Eclipse
- 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. |