Get docker container id from container name

后端 未结 9 1667
無奈伤痛
無奈伤痛 2020-12-12 11:48

What is the command to get the docker container id from the container name?

9条回答
  •  天命终不由人
    2020-12-12 12:22

    In my case I was running Tensorflow Docker container in Ubuntu 20.04 :Run your docker container in One terminal , I ran it with

    docker run -it od
    

    And then started another terminal and ran below docker ps with sudo:

    sudo docker ps
    

    I successfully got container id:

    CONTAINER ID        IMAGE               COMMAND             CREATED             
    STATUS              PORTS               NAMES
    e4ca1ad20b84        od                  "/bin/bash"         18 minutes ago      
    Up 18 minutes                           unruffled_stonebraker
    

提交回复
热议问题