Scenario / Questions
On Ubuntu 12.04.4 I installed Docker 1.1.2. I have tried various attempts at setting the image id using:
sudo docker run -i -t --name=container1 ubuntu date
However, my attempts seem to fail. Every time I do a
docker ps -a the image id has been randomized. I can set the hostname if I add
-h container1 but I want to set the image id. What am I missing here? Thanks!
Find below all possible solutions or suggestions for the above questions..
Sorry for the late response, I’m on version 1.1.2 myself now and the correct way of naming your container is as follows:
sudo docker run --name="testname" image command
testname is the name you want to give the container.
Have fun dockering!
-name container1 work? I guess it should equal to
--name=container1 (I don’t have a Docker instance near me to try out), but you never know.
sudo docker run -i -t –name container1 ubuntu date
As used in this example: https://docs.docker.com/examples/postgresql_service/
Is it possible this is just a misconception between the container name and container ID? The container ID will always be a random hash. There is a separate column for the container name:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3109b5cbbee2 firehoseprivate_firehose:latest /bin/sh -c 'bundle e 17 hours ago Exited (-1) 17 hours ago firehoseprivate_firehose_1
In this example, I have started the container using:
docker run --name firehoseprivate_firehose_1 firehoseprivate_firehose
The name column gets set to the name I specified. But it still gets a unique ID for reference. You can reference the container either by name or ID. For example:
docker inspect firehoseprivate_firehose_1
docker inspect 3109b5cbbee2
Are both valid.
Kubernetes Free Online Tutorial, Kubernetes Beginner Tutorial
DevOps Free Online Tutorial, DevOps Beginner Tutorial
Ansible Free Online Tutorial, Ansible Beginner Tutorial
Docker Free Online Tutorial, Docker Beginner Tutorial
Openstack Free Online Tutorial, Openstack Beginner Tutorial
Disclaimer: This has been sourced from a third party syndicated feed through internet. We are not responsibility or liability for its dependability, trustworthiness, reliability and data of the text. We reserves the sole right to alter, delete or remove (without notice) the content in its absolute discretion for any reason whatsoever.