Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is empty 'docker-machine ls' output valid when 'docker ps' shows running containers?

I have docker for windows running on windows 10. I think its working correctly. I saw something interesting and wanted to ask if anyone had any thoughts on this.

I have two docker images running. The command "docker ps" lists them (below). When I run "docker-machine ls" I get nothing. Shouldn't "docker-machine ls" also have results?

E:\Public\docker>docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                    NAMES
8c4b5b2fd86b        obd-sdk                   "nginx -g 'daemon ..."   19 hours ago        Up 19 hours         0.0.0.0:8009->80/tcp     obdsdk
32a05196bcb3        obd-registrationservice   "java -Djava.secur..."   20 hours ago        Up 20 hours         0.0.0.0:8110->8110/tcp   obdregsvc

E:\Public\docker>docker-machine ls
NAME   ACTIVE   DRIVER   STATE   URL   SWARM   DOCKER   ERRORS

E:\Public\docker>

Thanks, Matt

Edit: this is a screen shot of a second windows 10 machine in which I do have dockertoolbox/kitematic running with Hyper-v. enter image description here

like image 821
tatmanblue Avatar asked Sep 01 '17 17:09

tatmanblue


People also ask

What is the difference between docker ps and docker container ls?

There is no difference between the docker ps (docker process status) and docker container ls (docker container list) commands in terms of functionality. They even allow the same set of flags. The only real difference between the two is the fact that the latter is newer and more verbose than the former.

What does docker ps command do?

The docker ps command, which is available inside the container, is used to see the status of the process. This is similar to the standard ps command in the Linux environment and is not a docker ps command that we run on the Docker host machine.

What is docker ps status?

ps means “Process Status”, so docker ps basically shows all of the Docker processes actively running. docker ps lists all containers that are up and running. -a means all (both stopped and running) containers. Follow this answer to receive notifications. edited Nov 11, 2021 at 0:15.

How do you check if a docker container is running or not?

You can check with this command systemctl status docker it will show the status of the docker. If you want to start you can use systemctl start docker instead of systemctl you can try also with service , service docker status and service docker start respectively.


1 Answers

docker-machine is used as a part of Docker Toolbox.

Docker Toolbox is Virtual Box + Docker Machine + boot2docker unix image with docker + Kitematic

Docker for Windows is Hyper-V based Moby Linux with Docker. So you are not using docker toolbox that is why docker-machine ls is empty. While docker ps is showing you results. Docker for windows tries to give you more native experience with docker compared to Toolbox.

For more details refer to below links

https://docs.docker.com/machine/overview/#what-is-docker-machine https://www.docker.com/products/docker-toolbox

like image 100
Tarun Lalwani Avatar answered Oct 02 '22 21:10

Tarun Lalwani