Get docker container id from container name

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

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

9条回答
  •  一向
    一向 (楼主)
    2020-12-12 12:08

    1. Get container Ids of running containers ::

      $docker ps -qf "name=IMAGE_NAME"
      
          -f: Filter output based on conditions provided
          -q: Only display numeric container IDs
      
    2. Get container Ids of all containers ::

      $docker ps -aqf "name=IMAGE_NAME"
      
          -a: all containers
      

提交回复
热议问题