How to list containers in Docker
There's a command to list images, docker images
, but there doesn't seem to be a corresponding docker containers
.
Other than becoming root and looking into /var/lib/docker
there doesn't seem a way to do that. Am I missing something? Is that something one isn't supposed to do?
docker
add a comment |
There's a command to list images, docker images
, but there doesn't seem to be a corresponding docker containers
.
Other than becoming root and looking into /var/lib/docker
there doesn't seem a way to do that. Am I missing something? Is that something one isn't supposed to do?
docker
Similar question on Stack Overflow stackoverflow.com/questions/38464549/…
– Yogesh Darji
Aug 29 '17 at 16:25
add a comment |
There's a command to list images, docker images
, but there doesn't seem to be a corresponding docker containers
.
Other than becoming root and looking into /var/lib/docker
there doesn't seem a way to do that. Am I missing something? Is that something one isn't supposed to do?
docker
There's a command to list images, docker images
, but there doesn't seem to be a corresponding docker containers
.
Other than becoming root and looking into /var/lib/docker
there doesn't seem a way to do that. Am I missing something? Is that something one isn't supposed to do?
docker
docker
edited Jun 21 '18 at 19:58


Peter Mortensen
13.5k1983111
13.5k1983111
asked May 30 '13 at 15:41
w00t
7,95153348
7,95153348
Similar question on Stack Overflow stackoverflow.com/questions/38464549/…
– Yogesh Darji
Aug 29 '17 at 16:25
add a comment |
Similar question on Stack Overflow stackoverflow.com/questions/38464549/…
– Yogesh Darji
Aug 29 '17 at 16:25
Similar question on Stack Overflow stackoverflow.com/questions/38464549/…
– Yogesh Darji
Aug 29 '17 at 16:25
Similar question on Stack Overflow stackoverflow.com/questions/38464549/…
– Yogesh Darji
Aug 29 '17 at 16:25
add a comment |
12 Answers
12
active
oldest
votes
To show only running containers use the given command:
docker ps
To show all containers use the given command:
docker ps -a
To show the latest created container (includes all states) use the given command:
docker ps -l
To show n last created containers (includes all states) use the given command:
docker ps -n=-1
To display total file sizes use the given command:
docker ps -s
The content presented above is from docker.com.
In the new version of Docker, commands are updated, and some management commands are added:
docker container ls
Is used to list all the running containers.
docker container ls -a
Is used to list all the containers created irrespective of its state.
Here container is the management command.
112
And then, if you want to clean them all:docker rm `docker ps -aq`
– cregox
Nov 13 '15 at 20:28
1
I looked at the "docker ps -a", and list out about 10 docker name to remove one by one. After finish removal, come back and see your comment (cwl)
– lean
Oct 26 '16 at 10:28
8
Also for folks curious about an alternate form of command substitution @cregox's oneliner can be rewritten asdocker rm $(docker ps -aq)
– mbigras
Feb 25 '17 at 6:00
@RutgerHofste both commands (docker rm
anddocker ps
) do show up in docker's help.
– Munchkin
Oct 16 '17 at 12:28
4
Another helpful way to clean all unnecessary items like dangling containers, unused images, logs etc is by usingdocker system prune --all
. You can find the docker documentation here
– Arun Thundyill Saseendran
Oct 19 '17 at 14:42
|
show 2 more comments
To list all running and stopped containers
docker ps -a
To list all running containers (just stating the obvious and also example use of -f filtering option)
docker ps -a -f status=running
To list all running and stopped containers, showing only their container id
docker ps -aq
To remove all containers that are NOT running
docker rm `docker ps -aq -f status=exited`
add a comment |
Note that some time ago there was an update to this command. It will not show the container size by default (since this is rather expensive for many running containers). Use docker ps -s
to display container size as well.
As per mrh's answer below, you will also need the -a switch to view containers that are not running (likely to be the case for those you'd like to remove), so the final command isdocker ps -as
(don't forget to prependsudo
if the daemon is running as root)
– Anthony DiSanti
Apr 19 '16 at 23:56
add a comment |
docker ps -s will show the size of running containers only.
To check the size of all containers use docker ps -as
add a comment |
To list only the containers SHA1:
docker ps -aq --no-trunc
That way, you can use the list of all containers for other commands (which accept multiple container ids as parameters).
For example, to list only the name of all containers (since docker ps
list only their names with other information):
docker inspect --format='{{.Name}}' $(sudo docker ps -aq --no-trunc)
add a comment |
There are also the following options:
docker container ls
docker container ls -a
# --all, -a
# Show all containers (default shows just running)
since: 1.13.0 (2017-01-18):
Restructure CLI commands by adding
docker image
anddocker container
commands for more consistency #26025
and as stated here: Introducing Docker 1.13, users are encouraged to adopt the new syntax:
CLI restructured
In Docker 1.13, we regrouped every command to sit under the logical object it’s interacting with. For example
list
andstart
of containers are now subcommands ofdocker container
andhistory
is a subcommand ofdocker image
.
These changes let us clean up the Docker CLI syntax, improve help text and make Docker simpler to use. The old command syntax is still supported, but we encourage everybody to adopt the new syntax.
1
great info, a shame thatdocker --help
has the suggested interface 3 pages back in its output, hidden before the deprecated commands!
– danio
Mar 8 '18 at 10:07
add a comment |
The Docker command set is simple and holds together well:
docker stack ls
docker service ls
docker image ls
docker container ls
Teaching the aliases first is confusing. Once you understand what's going on, they can save some keystrokes:
docker images -> docker image ls
docker ps -> docker container ls
docker rmi -> docker image rm
docker rm -> docker container rm
There are several aliases in Docker. For instance:
docker rmi
docker image rm
docker image rmi
docker image remove
are all the same command (see for your self using docker help image rm
).
add a comment |
I got the error message Cannot connect to the Docker daemon.
I forgot I am running the daemon as root and needed sudo
:
$ sudo docker ps
1
alias docker="sudo --group docker docker"
– ctrl-alt-delor
Feb 13 '17 at 18:15
add a comment |
Command to get all containers ::
docker ps -a
Command to get running container::
docker ps
add a comment |
There are many ways to list all containers.
You can find using 3 Aliases
ls, ps, list
like this.
sudo docker container ls
sudo docker container ps
sudo docker container list
sudo docker ps
sudo docker ps -a
You can also use give option[option]
.
Options -:
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
You can use an option like this:
sudo docker ps //Showing only running containers
sudo docker ps -a //All container (running + stopped)
sudo docker pa -l // latest
sudo docker ps -n <int valuse 1,2,3 etc>// latest number of created containers
sudo docker ps -s // Display container with size
sudo docker ps -q // Only display numeric IDs for containers
docker docker ps -a | tail -n 1 //oldest container
add a comment |
docker ps [OPTIONS]
Following command will show only running containers by default.
docker ps
To see all containers:
docker ps -a
For showing the latest created container:
docker ps -l
add a comment |
It is always recommended to add the user in a Docker group.
That can be done like:
sudo groupadd docker
sudo usermod -aG docker $USER --> Equivalent to this you can add the user
in /etc/passwd manually.
Hey any one help me with docker
– harkesh kumar
Nov 19 '18 at 12:31
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f16840409%2fhow-to-list-containers-in-docker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
To show only running containers use the given command:
docker ps
To show all containers use the given command:
docker ps -a
To show the latest created container (includes all states) use the given command:
docker ps -l
To show n last created containers (includes all states) use the given command:
docker ps -n=-1
To display total file sizes use the given command:
docker ps -s
The content presented above is from docker.com.
In the new version of Docker, commands are updated, and some management commands are added:
docker container ls
Is used to list all the running containers.
docker container ls -a
Is used to list all the containers created irrespective of its state.
Here container is the management command.
112
And then, if you want to clean them all:docker rm `docker ps -aq`
– cregox
Nov 13 '15 at 20:28
1
I looked at the "docker ps -a", and list out about 10 docker name to remove one by one. After finish removal, come back and see your comment (cwl)
– lean
Oct 26 '16 at 10:28
8
Also for folks curious about an alternate form of command substitution @cregox's oneliner can be rewritten asdocker rm $(docker ps -aq)
– mbigras
Feb 25 '17 at 6:00
@RutgerHofste both commands (docker rm
anddocker ps
) do show up in docker's help.
– Munchkin
Oct 16 '17 at 12:28
4
Another helpful way to clean all unnecessary items like dangling containers, unused images, logs etc is by usingdocker system prune --all
. You can find the docker documentation here
– Arun Thundyill Saseendran
Oct 19 '17 at 14:42
|
show 2 more comments
To show only running containers use the given command:
docker ps
To show all containers use the given command:
docker ps -a
To show the latest created container (includes all states) use the given command:
docker ps -l
To show n last created containers (includes all states) use the given command:
docker ps -n=-1
To display total file sizes use the given command:
docker ps -s
The content presented above is from docker.com.
In the new version of Docker, commands are updated, and some management commands are added:
docker container ls
Is used to list all the running containers.
docker container ls -a
Is used to list all the containers created irrespective of its state.
Here container is the management command.
112
And then, if you want to clean them all:docker rm `docker ps -aq`
– cregox
Nov 13 '15 at 20:28
1
I looked at the "docker ps -a", and list out about 10 docker name to remove one by one. After finish removal, come back and see your comment (cwl)
– lean
Oct 26 '16 at 10:28
8
Also for folks curious about an alternate form of command substitution @cregox's oneliner can be rewritten asdocker rm $(docker ps -aq)
– mbigras
Feb 25 '17 at 6:00
@RutgerHofste both commands (docker rm
anddocker ps
) do show up in docker's help.
– Munchkin
Oct 16 '17 at 12:28
4
Another helpful way to clean all unnecessary items like dangling containers, unused images, logs etc is by usingdocker system prune --all
. You can find the docker documentation here
– Arun Thundyill Saseendran
Oct 19 '17 at 14:42
|
show 2 more comments
To show only running containers use the given command:
docker ps
To show all containers use the given command:
docker ps -a
To show the latest created container (includes all states) use the given command:
docker ps -l
To show n last created containers (includes all states) use the given command:
docker ps -n=-1
To display total file sizes use the given command:
docker ps -s
The content presented above is from docker.com.
In the new version of Docker, commands are updated, and some management commands are added:
docker container ls
Is used to list all the running containers.
docker container ls -a
Is used to list all the containers created irrespective of its state.
Here container is the management command.
To show only running containers use the given command:
docker ps
To show all containers use the given command:
docker ps -a
To show the latest created container (includes all states) use the given command:
docker ps -l
To show n last created containers (includes all states) use the given command:
docker ps -n=-1
To display total file sizes use the given command:
docker ps -s
The content presented above is from docker.com.
In the new version of Docker, commands are updated, and some management commands are added:
docker container ls
Is used to list all the running containers.
docker container ls -a
Is used to list all the containers created irrespective of its state.
Here container is the management command.
edited Jun 21 '18 at 19:59


Peter Mortensen
13.5k1983111
13.5k1983111
answered May 30 '13 at 17:15
vieux
16.1k32124
16.1k32124
112
And then, if you want to clean them all:docker rm `docker ps -aq`
– cregox
Nov 13 '15 at 20:28
1
I looked at the "docker ps -a", and list out about 10 docker name to remove one by one. After finish removal, come back and see your comment (cwl)
– lean
Oct 26 '16 at 10:28
8
Also for folks curious about an alternate form of command substitution @cregox's oneliner can be rewritten asdocker rm $(docker ps -aq)
– mbigras
Feb 25 '17 at 6:00
@RutgerHofste both commands (docker rm
anddocker ps
) do show up in docker's help.
– Munchkin
Oct 16 '17 at 12:28
4
Another helpful way to clean all unnecessary items like dangling containers, unused images, logs etc is by usingdocker system prune --all
. You can find the docker documentation here
– Arun Thundyill Saseendran
Oct 19 '17 at 14:42
|
show 2 more comments
112
And then, if you want to clean them all:docker rm `docker ps -aq`
– cregox
Nov 13 '15 at 20:28
1
I looked at the "docker ps -a", and list out about 10 docker name to remove one by one. After finish removal, come back and see your comment (cwl)
– lean
Oct 26 '16 at 10:28
8
Also for folks curious about an alternate form of command substitution @cregox's oneliner can be rewritten asdocker rm $(docker ps -aq)
– mbigras
Feb 25 '17 at 6:00
@RutgerHofste both commands (docker rm
anddocker ps
) do show up in docker's help.
– Munchkin
Oct 16 '17 at 12:28
4
Another helpful way to clean all unnecessary items like dangling containers, unused images, logs etc is by usingdocker system prune --all
. You can find the docker documentation here
– Arun Thundyill Saseendran
Oct 19 '17 at 14:42
112
112
And then, if you want to clean them all:
docker rm `docker ps -aq`
– cregox
Nov 13 '15 at 20:28
And then, if you want to clean them all:
docker rm `docker ps -aq`
– cregox
Nov 13 '15 at 20:28
1
1
I looked at the "docker ps -a", and list out about 10 docker name to remove one by one. After finish removal, come back and see your comment (cwl)
– lean
Oct 26 '16 at 10:28
I looked at the "docker ps -a", and list out about 10 docker name to remove one by one. After finish removal, come back and see your comment (cwl)
– lean
Oct 26 '16 at 10:28
8
8
Also for folks curious about an alternate form of command substitution @cregox's oneliner can be rewritten as
docker rm $(docker ps -aq)
– mbigras
Feb 25 '17 at 6:00
Also for folks curious about an alternate form of command substitution @cregox's oneliner can be rewritten as
docker rm $(docker ps -aq)
– mbigras
Feb 25 '17 at 6:00
@RutgerHofste both commands (
docker rm
and docker ps
) do show up in docker's help.– Munchkin
Oct 16 '17 at 12:28
@RutgerHofste both commands (
docker rm
and docker ps
) do show up in docker's help.– Munchkin
Oct 16 '17 at 12:28
4
4
Another helpful way to clean all unnecessary items like dangling containers, unused images, logs etc is by using
docker system prune --all
. You can find the docker documentation here– Arun Thundyill Saseendran
Oct 19 '17 at 14:42
Another helpful way to clean all unnecessary items like dangling containers, unused images, logs etc is by using
docker system prune --all
. You can find the docker documentation here– Arun Thundyill Saseendran
Oct 19 '17 at 14:42
|
show 2 more comments
To list all running and stopped containers
docker ps -a
To list all running containers (just stating the obvious and also example use of -f filtering option)
docker ps -a -f status=running
To list all running and stopped containers, showing only their container id
docker ps -aq
To remove all containers that are NOT running
docker rm `docker ps -aq -f status=exited`
add a comment |
To list all running and stopped containers
docker ps -a
To list all running containers (just stating the obvious and also example use of -f filtering option)
docker ps -a -f status=running
To list all running and stopped containers, showing only their container id
docker ps -aq
To remove all containers that are NOT running
docker rm `docker ps -aq -f status=exited`
add a comment |
To list all running and stopped containers
docker ps -a
To list all running containers (just stating the obvious and also example use of -f filtering option)
docker ps -a -f status=running
To list all running and stopped containers, showing only their container id
docker ps -aq
To remove all containers that are NOT running
docker rm `docker ps -aq -f status=exited`
To list all running and stopped containers
docker ps -a
To list all running containers (just stating the obvious and also example use of -f filtering option)
docker ps -a -f status=running
To list all running and stopped containers, showing only their container id
docker ps -aq
To remove all containers that are NOT running
docker rm `docker ps -aq -f status=exited`
answered Apr 12 '16 at 6:37


kramfs
1,401196
1,401196
add a comment |
add a comment |
Note that some time ago there was an update to this command. It will not show the container size by default (since this is rather expensive for many running containers). Use docker ps -s
to display container size as well.
As per mrh's answer below, you will also need the -a switch to view containers that are not running (likely to be the case for those you'd like to remove), so the final command isdocker ps -as
(don't forget to prependsudo
if the daemon is running as root)
– Anthony DiSanti
Apr 19 '16 at 23:56
add a comment |
Note that some time ago there was an update to this command. It will not show the container size by default (since this is rather expensive for many running containers). Use docker ps -s
to display container size as well.
As per mrh's answer below, you will also need the -a switch to view containers that are not running (likely to be the case for those you'd like to remove), so the final command isdocker ps -as
(don't forget to prependsudo
if the daemon is running as root)
– Anthony DiSanti
Apr 19 '16 at 23:56
add a comment |
Note that some time ago there was an update to this command. It will not show the container size by default (since this is rather expensive for many running containers). Use docker ps -s
to display container size as well.
Note that some time ago there was an update to this command. It will not show the container size by default (since this is rather expensive for many running containers). Use docker ps -s
to display container size as well.
answered Jul 30 '13 at 11:29
qkrijger
15k62734
15k62734
As per mrh's answer below, you will also need the -a switch to view containers that are not running (likely to be the case for those you'd like to remove), so the final command isdocker ps -as
(don't forget to prependsudo
if the daemon is running as root)
– Anthony DiSanti
Apr 19 '16 at 23:56
add a comment |
As per mrh's answer below, you will also need the -a switch to view containers that are not running (likely to be the case for those you'd like to remove), so the final command isdocker ps -as
(don't forget to prependsudo
if the daemon is running as root)
– Anthony DiSanti
Apr 19 '16 at 23:56
As per mrh's answer below, you will also need the -a switch to view containers that are not running (likely to be the case for those you'd like to remove), so the final command is
docker ps -as
(don't forget to prepend sudo
if the daemon is running as root)– Anthony DiSanti
Apr 19 '16 at 23:56
As per mrh's answer below, you will also need the -a switch to view containers that are not running (likely to be the case for those you'd like to remove), so the final command is
docker ps -as
(don't forget to prepend sudo
if the daemon is running as root)– Anthony DiSanti
Apr 19 '16 at 23:56
add a comment |
docker ps -s will show the size of running containers only.
To check the size of all containers use docker ps -as
add a comment |
docker ps -s will show the size of running containers only.
To check the size of all containers use docker ps -as
add a comment |
docker ps -s will show the size of running containers only.
To check the size of all containers use docker ps -as
docker ps -s will show the size of running containers only.
To check the size of all containers use docker ps -as
answered Dec 13 '14 at 13:01
mrh
33927
33927
add a comment |
add a comment |
To list only the containers SHA1:
docker ps -aq --no-trunc
That way, you can use the list of all containers for other commands (which accept multiple container ids as parameters).
For example, to list only the name of all containers (since docker ps
list only their names with other information):
docker inspect --format='{{.Name}}' $(sudo docker ps -aq --no-trunc)
add a comment |
To list only the containers SHA1:
docker ps -aq --no-trunc
That way, you can use the list of all containers for other commands (which accept multiple container ids as parameters).
For example, to list only the name of all containers (since docker ps
list only their names with other information):
docker inspect --format='{{.Name}}' $(sudo docker ps -aq --no-trunc)
add a comment |
To list only the containers SHA1:
docker ps -aq --no-trunc
That way, you can use the list of all containers for other commands (which accept multiple container ids as parameters).
For example, to list only the name of all containers (since docker ps
list only their names with other information):
docker inspect --format='{{.Name}}' $(sudo docker ps -aq --no-trunc)
To list only the containers SHA1:
docker ps -aq --no-trunc
That way, you can use the list of all containers for other commands (which accept multiple container ids as parameters).
For example, to list only the name of all containers (since docker ps
list only their names with other information):
docker inspect --format='{{.Name}}' $(sudo docker ps -aq --no-trunc)
answered May 6 '15 at 7:50
VonC
830k28926113157
830k28926113157
add a comment |
add a comment |
There are also the following options:
docker container ls
docker container ls -a
# --all, -a
# Show all containers (default shows just running)
since: 1.13.0 (2017-01-18):
Restructure CLI commands by adding
docker image
anddocker container
commands for more consistency #26025
and as stated here: Introducing Docker 1.13, users are encouraged to adopt the new syntax:
CLI restructured
In Docker 1.13, we regrouped every command to sit under the logical object it’s interacting with. For example
list
andstart
of containers are now subcommands ofdocker container
andhistory
is a subcommand ofdocker image
.
These changes let us clean up the Docker CLI syntax, improve help text and make Docker simpler to use. The old command syntax is still supported, but we encourage everybody to adopt the new syntax.
1
great info, a shame thatdocker --help
has the suggested interface 3 pages back in its output, hidden before the deprecated commands!
– danio
Mar 8 '18 at 10:07
add a comment |
There are also the following options:
docker container ls
docker container ls -a
# --all, -a
# Show all containers (default shows just running)
since: 1.13.0 (2017-01-18):
Restructure CLI commands by adding
docker image
anddocker container
commands for more consistency #26025
and as stated here: Introducing Docker 1.13, users are encouraged to adopt the new syntax:
CLI restructured
In Docker 1.13, we regrouped every command to sit under the logical object it’s interacting with. For example
list
andstart
of containers are now subcommands ofdocker container
andhistory
is a subcommand ofdocker image
.
These changes let us clean up the Docker CLI syntax, improve help text and make Docker simpler to use. The old command syntax is still supported, but we encourage everybody to adopt the new syntax.
1
great info, a shame thatdocker --help
has the suggested interface 3 pages back in its output, hidden before the deprecated commands!
– danio
Mar 8 '18 at 10:07
add a comment |
There are also the following options:
docker container ls
docker container ls -a
# --all, -a
# Show all containers (default shows just running)
since: 1.13.0 (2017-01-18):
Restructure CLI commands by adding
docker image
anddocker container
commands for more consistency #26025
and as stated here: Introducing Docker 1.13, users are encouraged to adopt the new syntax:
CLI restructured
In Docker 1.13, we regrouped every command to sit under the logical object it’s interacting with. For example
list
andstart
of containers are now subcommands ofdocker container
andhistory
is a subcommand ofdocker image
.
These changes let us clean up the Docker CLI syntax, improve help text and make Docker simpler to use. The old command syntax is still supported, but we encourage everybody to adopt the new syntax.
There are also the following options:
docker container ls
docker container ls -a
# --all, -a
# Show all containers (default shows just running)
since: 1.13.0 (2017-01-18):
Restructure CLI commands by adding
docker image
anddocker container
commands for more consistency #26025
and as stated here: Introducing Docker 1.13, users are encouraged to adopt the new syntax:
CLI restructured
In Docker 1.13, we regrouped every command to sit under the logical object it’s interacting with. For example
list
andstart
of containers are now subcommands ofdocker container
andhistory
is a subcommand ofdocker image
.
These changes let us clean up the Docker CLI syntax, improve help text and make Docker simpler to use. The old command syntax is still supported, but we encourage everybody to adopt the new syntax.
edited Dec 14 '17 at 13:37
answered Jun 24 '17 at 21:22
tgogos
5,80773677
5,80773677
1
great info, a shame thatdocker --help
has the suggested interface 3 pages back in its output, hidden before the deprecated commands!
– danio
Mar 8 '18 at 10:07
add a comment |
1
great info, a shame thatdocker --help
has the suggested interface 3 pages back in its output, hidden before the deprecated commands!
– danio
Mar 8 '18 at 10:07
1
1
great info, a shame that
docker --help
has the suggested interface 3 pages back in its output, hidden before the deprecated commands!– danio
Mar 8 '18 at 10:07
great info, a shame that
docker --help
has the suggested interface 3 pages back in its output, hidden before the deprecated commands!– danio
Mar 8 '18 at 10:07
add a comment |
The Docker command set is simple and holds together well:
docker stack ls
docker service ls
docker image ls
docker container ls
Teaching the aliases first is confusing. Once you understand what's going on, they can save some keystrokes:
docker images -> docker image ls
docker ps -> docker container ls
docker rmi -> docker image rm
docker rm -> docker container rm
There are several aliases in Docker. For instance:
docker rmi
docker image rm
docker image rmi
docker image remove
are all the same command (see for your self using docker help image rm
).
add a comment |
The Docker command set is simple and holds together well:
docker stack ls
docker service ls
docker image ls
docker container ls
Teaching the aliases first is confusing. Once you understand what's going on, they can save some keystrokes:
docker images -> docker image ls
docker ps -> docker container ls
docker rmi -> docker image rm
docker rm -> docker container rm
There are several aliases in Docker. For instance:
docker rmi
docker image rm
docker image rmi
docker image remove
are all the same command (see for your self using docker help image rm
).
add a comment |
The Docker command set is simple and holds together well:
docker stack ls
docker service ls
docker image ls
docker container ls
Teaching the aliases first is confusing. Once you understand what's going on, they can save some keystrokes:
docker images -> docker image ls
docker ps -> docker container ls
docker rmi -> docker image rm
docker rm -> docker container rm
There are several aliases in Docker. For instance:
docker rmi
docker image rm
docker image rmi
docker image remove
are all the same command (see for your self using docker help image rm
).
The Docker command set is simple and holds together well:
docker stack ls
docker service ls
docker image ls
docker container ls
Teaching the aliases first is confusing. Once you understand what's going on, they can save some keystrokes:
docker images -> docker image ls
docker ps -> docker container ls
docker rmi -> docker image rm
docker rm -> docker container rm
There are several aliases in Docker. For instance:
docker rmi
docker image rm
docker image rmi
docker image remove
are all the same command (see for your self using docker help image rm
).
edited Jun 21 '18 at 20:01


Peter Mortensen
13.5k1983111
13.5k1983111
answered Apr 26 '18 at 17:41
Limited Atonement
4,21623650
4,21623650
add a comment |
add a comment |
I got the error message Cannot connect to the Docker daemon.
I forgot I am running the daemon as root and needed sudo
:
$ sudo docker ps
1
alias docker="sudo --group docker docker"
– ctrl-alt-delor
Feb 13 '17 at 18:15
add a comment |
I got the error message Cannot connect to the Docker daemon.
I forgot I am running the daemon as root and needed sudo
:
$ sudo docker ps
1
alias docker="sudo --group docker docker"
– ctrl-alt-delor
Feb 13 '17 at 18:15
add a comment |
I got the error message Cannot connect to the Docker daemon.
I forgot I am running the daemon as root and needed sudo
:
$ sudo docker ps
I got the error message Cannot connect to the Docker daemon.
I forgot I am running the daemon as root and needed sudo
:
$ sudo docker ps
edited Mar 16 '17 at 19:43
fduff
2,33312029
2,33312029
answered Jan 22 '16 at 19:52
vezenkov
2,2522024
2,2522024
1
alias docker="sudo --group docker docker"
– ctrl-alt-delor
Feb 13 '17 at 18:15
add a comment |
1
alias docker="sudo --group docker docker"
– ctrl-alt-delor
Feb 13 '17 at 18:15
1
1
alias docker="sudo --group docker docker"
– ctrl-alt-delor
Feb 13 '17 at 18:15
alias docker="sudo --group docker docker"
– ctrl-alt-delor
Feb 13 '17 at 18:15
add a comment |
Command to get all containers ::
docker ps -a
Command to get running container::
docker ps
add a comment |
Command to get all containers ::
docker ps -a
Command to get running container::
docker ps
add a comment |
Command to get all containers ::
docker ps -a
Command to get running container::
docker ps
Command to get all containers ::
docker ps -a
Command to get running container::
docker ps
answered Sep 13 '18 at 13:27
Archana
337214
337214
add a comment |
add a comment |
There are many ways to list all containers.
You can find using 3 Aliases
ls, ps, list
like this.
sudo docker container ls
sudo docker container ps
sudo docker container list
sudo docker ps
sudo docker ps -a
You can also use give option[option]
.
Options -:
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
You can use an option like this:
sudo docker ps //Showing only running containers
sudo docker ps -a //All container (running + stopped)
sudo docker pa -l // latest
sudo docker ps -n <int valuse 1,2,3 etc>// latest number of created containers
sudo docker ps -s // Display container with size
sudo docker ps -q // Only display numeric IDs for containers
docker docker ps -a | tail -n 1 //oldest container
add a comment |
There are many ways to list all containers.
You can find using 3 Aliases
ls, ps, list
like this.
sudo docker container ls
sudo docker container ps
sudo docker container list
sudo docker ps
sudo docker ps -a
You can also use give option[option]
.
Options -:
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
You can use an option like this:
sudo docker ps //Showing only running containers
sudo docker ps -a //All container (running + stopped)
sudo docker pa -l // latest
sudo docker ps -n <int valuse 1,2,3 etc>// latest number of created containers
sudo docker ps -s // Display container with size
sudo docker ps -q // Only display numeric IDs for containers
docker docker ps -a | tail -n 1 //oldest container
add a comment |
There are many ways to list all containers.
You can find using 3 Aliases
ls, ps, list
like this.
sudo docker container ls
sudo docker container ps
sudo docker container list
sudo docker ps
sudo docker ps -a
You can also use give option[option]
.
Options -:
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
You can use an option like this:
sudo docker ps //Showing only running containers
sudo docker ps -a //All container (running + stopped)
sudo docker pa -l // latest
sudo docker ps -n <int valuse 1,2,3 etc>// latest number of created containers
sudo docker ps -s // Display container with size
sudo docker ps -q // Only display numeric IDs for containers
docker docker ps -a | tail -n 1 //oldest container
There are many ways to list all containers.
You can find using 3 Aliases
ls, ps, list
like this.
sudo docker container ls
sudo docker container ps
sudo docker container list
sudo docker ps
sudo docker ps -a
You can also use give option[option]
.
Options -:
-a, --all Show all containers (default shows just running)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display numeric IDs
-s, --size Display total file sizes
You can use an option like this:
sudo docker ps //Showing only running containers
sudo docker ps -a //All container (running + stopped)
sudo docker pa -l // latest
sudo docker ps -n <int valuse 1,2,3 etc>// latest number of created containers
sudo docker ps -s // Display container with size
sudo docker ps -q // Only display numeric IDs for containers
docker docker ps -a | tail -n 1 //oldest container
edited Nov 20 '18 at 10:59
answered Nov 19 '18 at 12:26


Mr Singh
1,042723
1,042723
add a comment |
add a comment |
docker ps [OPTIONS]
Following command will show only running containers by default.
docker ps
To see all containers:
docker ps -a
For showing the latest created container:
docker ps -l
add a comment |
docker ps [OPTIONS]
Following command will show only running containers by default.
docker ps
To see all containers:
docker ps -a
For showing the latest created container:
docker ps -l
add a comment |
docker ps [OPTIONS]
Following command will show only running containers by default.
docker ps
To see all containers:
docker ps -a
For showing the latest created container:
docker ps -l
docker ps [OPTIONS]
Following command will show only running containers by default.
docker ps
To see all containers:
docker ps -a
For showing the latest created container:
docker ps -l
edited Aug 29 '17 at 16:18
user7605325
answered Aug 29 '17 at 15:56


Nobita
548
548
add a comment |
add a comment |
It is always recommended to add the user in a Docker group.
That can be done like:
sudo groupadd docker
sudo usermod -aG docker $USER --> Equivalent to this you can add the user
in /etc/passwd manually.
Hey any one help me with docker
– harkesh kumar
Nov 19 '18 at 12:31
add a comment |
It is always recommended to add the user in a Docker group.
That can be done like:
sudo groupadd docker
sudo usermod -aG docker $USER --> Equivalent to this you can add the user
in /etc/passwd manually.
Hey any one help me with docker
– harkesh kumar
Nov 19 '18 at 12:31
add a comment |
It is always recommended to add the user in a Docker group.
That can be done like:
sudo groupadd docker
sudo usermod -aG docker $USER --> Equivalent to this you can add the user
in /etc/passwd manually.
It is always recommended to add the user in a Docker group.
That can be done like:
sudo groupadd docker
sudo usermod -aG docker $USER --> Equivalent to this you can add the user
in /etc/passwd manually.
edited Jun 21 '18 at 20:01


Peter Mortensen
13.5k1983111
13.5k1983111
answered May 4 '18 at 5:54


Prateek patel
12
12
Hey any one help me with docker
– harkesh kumar
Nov 19 '18 at 12:31
add a comment |
Hey any one help me with docker
– harkesh kumar
Nov 19 '18 at 12:31
Hey any one help me with docker
– harkesh kumar
Nov 19 '18 at 12:31
Hey any one help me with docker
– harkesh kumar
Nov 19 '18 at 12:31
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f16840409%2fhow-to-list-containers-in-docker%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Similar question on Stack Overflow stackoverflow.com/questions/38464549/…
– Yogesh Darji
Aug 29 '17 at 16:25