srakasat.blogg.se

Docker run image status 一直是 up 4 minutes
Docker run image status 一直是 up 4 minutes






docker run image status 一直是 up 4 minutes

I had created the container "nextcloud_server" with MariaDB as its "dependency." So that container is not listed in the output when using -latest flag.

  • The output includes all container states (that means even containers that are stopped will be listed).
  • Any containers that are used as a "dependency" will not be listed.
  • There are a few gotchas with this command. Here is a sample output of running the command docker ps -latest on my computer: $ docker ps -latestĥ8c7013a49c3 nextcloud "/entrypoint.sh apac…" 15 hours ago Up 15 hours 0.0.0.0:8010->80/tcp, :::8010->80/tcp nextcloud_serverħ3a6901a4846 lscr.io/linuxserver/transmission "/init" 16 hours ago Exited (137) 16 hours ago transmission_web The order is latest on the top and oldest on the bottom. Yes, you can list containers sorted in the order of their creation date using the -latest (or l for short). Show containers in the order they were created $ docker ps -filter "id=140161b8b139"ġ40161b8b139 mariadb "docker-entrypoint.s…" 15 hours ago Up 15 hours 3306/tcp nextcloud_dbĮasy! I got the container with the matched ID. I will use the following command to achieve that. I have a MariaDB container with the ID "140161b8b139". I have several containers running, but passing using the name filter only shows me the containers that match the name. I want to see details about containers, but only those with the name I am looking for. I have created a container that is named nextcloud_server. The docker ps command has a very useful option, -filter (or -f for short).Īs evident from the option name, you can filter out the containers using the following fields: Filter the output of docker ps for more accurate result $ docker ps -aĪs you can see, the -a option also shows a container that was stopped. I stopped the container transmission_web. To see the containers that are in the stopped state, use the -all (or -a) option like so: docker ps -all If you stop a running container, it still exists, only that it is not running anymore. Running docker ps will only show the docker containers that are active. Show all the containers (not just the running ones)Īs the UNIX ps command is used to show processes (programs that are being executed), Docker behaves similarly. Docker provides a few options that can be helpful when you run docker ps in a script. The details shown are the unique ID of the container, name of the image, command that the container is executing, date when the container was created, uptime, mapped ports and the container name.Īs a sysadmin, you will often be using this command in a script. Here is an example of executing docker ps on my computer: $ docker psĬONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESĥ8c7013a49c3 nextcloud "/entrypoint.sh apac…" 32 seconds ago Up 31 seconds 0.0.0.0:8010->80/tcp, :::8010->80/tcp nextcloud_serverġ40161b8b139 mariadb "docker-entrypoint.s…" 34 seconds ago Up 32 seconds 3306/tcp nextcloud_dbħ3a6901a4846 lscr.io/linuxserver/transmission "/init" 17 minutes ago Exited (137) 9 minutes ago transmission_webĪs you can see, this command displays details about all the running containers. Which, as you can guess, is used for listing docker containers. The docker ps commandĭocker has an alias to show all running containers with a POSIX friendly naming convention. Let's take a bit more detailed look at this essential Docker command. You can display stopped containers, filter the result or just display the container IDs. It shows the running containers: docker psĪctually, running this command gives you a list of running containers and their unique container ID, image name, the command it is executing, time since it is running (uptime), and the ports it is using.īut you can do a bit more with it. Stop the container we just started.One of the first Docker commands you use is the docker ps command. Let’s stop and remove all of our containers and take a look at fixing the random naming issue. When you restart a container, it will be started with the same flags or commands that it was originally started with.

    docker run image status 一直是 up 4 minutes

    Also, note that the status of the container is “Up X seconds”. Notice that the container we just restarted has been started in detached mode and has port 8080 exposed. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESĭ75e61fcad1e docker-gs-ping "/docker-gs-ping" 2 minutes ago Up 5 seconds 0.0.0.0:8080->8080/tcp inspiring_ishizakaį65dbbb9a548 docker-gs-ping "/docker-gs-ping" 4 minutes ago Exited (2) 2 minutes ago wizardly_joliotĪade1bf3d330 docker-gs-ping "/docker-gs-ping" 4 minutes ago Exited (2) 4 minutes ago magical_carsonĥ2d5ce3c15f0 docker-gs-ping "/docker-gs-ping" 10 minutes ago Exited (2) 4 minutes ago gifted_mestorf








    Docker run image status 一直是 up 4 minutes