Skip to content

docker command line interface usability #2149

@shamrin

Description

@shamrin

I'm creating this issue to describe usability issues I had when I started to play with docker. I'm still very new to it. I decided to write about it when I'm still not clouded by understanding how docker works. Do you interested in learning what a complete newbie finds confusing?. I hope you'll find it useful.

First of all, docker ps is confusing (it's the result of some manual playing with docker run and running docker build for the example Dockerfile on the main page):

vagrant@precise64:~/company$ docker ps -a
ID                  IMAGE                COMMAND                CREATED             STATUS              PORTS
5b18395ceac1        company/debian:7.1   echo hi                2 seconds ago       Exit 0
2a2ea0377136        86bda7d967b5         /bin/sh -c cd hellof   12 minutes ago      Exit 0
0de396b19d2b        63efc39a7dc9         /bin/sh -c curl -L h   12 minutes ago      Exit 0
225e55a69991        cb7f7c6e4fed         /bin/sh -c DEBIAN_FR   13 minutes ago      Exit 0
f4c6371b8ab6        e375ce73b4bd         /bin/sh -c pip insta   14 minutes ago      Exit 0
331dd5795693        a81178ba41a2         /bin/sh -c DEBIAN_FR   19 minutes ago      Exit 0
cf10f5e776c6        6a73ebd3d20d         /bin/sh -c DEBIAN_FR   20 minutes ago      Exit 0
18c136903694        company/debian:7.1   /bin/sh -c apt-get u   20 minutes ago      Exit 0
f87a1ec60a5b        company/debian:7.1   bash                   30 minutes ago      Exit 0
946e6b16e10e        company/debian:7.1   echo success           38 minutes ago      Exit 0
2c326c45094d        company/debian:7.1   cat /etc/debian_vers   About an hour ago   Exit 0
cbe6bc4958ca        company/debian:7.1   echo success           About an hour ago   Exit 0

What is the difference between ID and IMAGE, for example? Is COMMAND is actually the LAST COMMAND? Why each line created by docker build (the most recent lines) shows two ids? I wanted to save the result of command I ran 19 minutes ago. I was torn between using the ID or IMAGE of that or the later line. After talking on #docker irc, I started to understand that container is created from image by runing it (by the way, it would nice to have something like the previous sentence in docker ps help or docs). Finally I decided that 331dd5795693 will go. Let's commit it:

vagrant@precise64:~/company$ docker commit --help

Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY [TAG]]

Create a new image from a container's changes

  -author="": Author (eg. "John Hannibal Smith <[email protected]>"
  -m="": Commit message
  -run="": Config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs": ["22"]}')

Hmmm? Where to put an ID? Probably as a CONTAINTER in the usage. Then, how to name an image? Note, the command that "create[s] a new image" doesn't describe where to put image name. Okay, let's try just putting it as a second argument. I decided to go with repo/name:tag because that's how docker ps showed the images (IMAGE column):

vagrant@precise64:~/company$ docker commit 331dd5795693 company/product:python-pip
28b5eb899e97

Good, let's see what has been created:

vagrant@precise64:~/company$ docker images
REPOSITORY               TAG                 ID                  CREATED             SIZE
company/product:python-pip   latest              28b5eb899e97        15 seconds ago      226.7 MB (virtual 461.6 MB)
company/product              0.1                 2a80703a402b        29 minutes ago      5.718 MB (virtual 545.4 MB)
company/debian           7.1                 b3a25cdd0091        About an hour ago   119.8 MB (virtual 119.8 MB)
company/debian           latest              b3a25cdd0091        About an hour ago   119.8 MB (virtual 119.8 MB)
company/debian           wheezy              b3a25cdd0091        About an hour ago   119.8 MB (virtual 119.8 MB)

Why the first column is named REPOSITORY? I thought it's in fact REPO/NAME. Am I wrong? (By this time I failed to notice that python-pip is not listed as TAG).

Ok, let's run it:

vagrant@precise64:~/company$ docker run -i -t company/product:python-pip
Unable to find image 'company/product:python-pip' (tag: python-pip) locally
Pulling repository company/product
2013/10/09 18:03:12 Internal server error: 404 trying to fetch remote history for company/product

What?! Why does it go to the public repository? Only now I noticed that python-pip is actually part of the image name, not a tag as I intended. Still what's the actual name of the image I created? I have no idea now.

I'll stop now. I could start listing actual issues that led to my confusion. Some of them:

  1. confusion understanding repo/name:tag format (by the way, am I right to parse it this way?)
  2. confusion understanding ID, CONTAINER, IMAGE, COMMAND
  3. something more I forgot to list here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions