Skip to content

--link only accepts container names, not container IDs #5186

@mathuin

Description

@mathuin

What actually happened

jmt@nala:~$ docker run --rm -t -i --link `cat /var/run/database_prod.cid`:db mathuin/database bash
2014/04/13 14:17:08 Error: Could not find entity for 6c5f02d0a44e2b414b79a59fb9c8746f0b3dcb449a42e9833ef9913da71fc3ab

What I expected to happen

I expected that container IDs would work when used with the --link option to the run command.

Why I expected that to happen

http://docs.docker.io/en/latest/use/working_with_links_names/ describes how to work with links between containers. The --link option takes one argument -- a name and an alias separated by a colon. In the general case, Docker supports the use of container IDs wherever names are supported. Examples include commands such as top.

My current workaround

jmt@nala:~$ docker run -ti --rm --link `cat /var/run/database_prod.cid | xargs docker inspect --format='{{.Name}}'`:db busybox sh
/ # echo $DB_PORT_5432_TCP_ADDR
172.17.0.2
/ # 

System information

I am running Ubuntu 14.04 development with all current updates.

jmt@nala:~$ uname -a
Linux nala 3.13.0-23-generic #45-Ubuntu SMP Fri Apr 4 06:58:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
jmt@nala:~$ docker version
Client version: 0.10.0
Client API version: 1.10
Go version (client): go1.2.1
Git commit (client): dc9c28f
Server version: 0.10.0
Server API version: 1.10
Git commit (server): dc9c28f
Go version (server): go1.2.1
Last stable version: 0.10.0
jmt@nala:~$ docker info
Containers: 5
Images: 223
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Dirs: 233
Execution Driver: native-0.1
Kernel Version: 3.13.0-23-generic
Username: mathuin
Registry: [https://index.docker.io/v1/]
WARNING: No swap limit support

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