Welcome to the Linux Foundation Forum!

Lab7.1 - Issues running "docker container ls"

Hi all,

I'm on Lab 7.1 , I have "Docker version 20.10.6-ce, build 8728dd246c3a" installed on OpenSuse.

The thing I'm seeing is if I run "docker container ls" I get nothing back.

If I run "docker container ls -a" then I see all my containers. Why would that be?

Comments

  • chrispokorni
    chrispokorni Posts: 2,340

    Hi @PeterCharuza,

    The output difference between the docker container ls and docker container ls -a commands is an expected behavior of Docker. You may run the docker container ls --help command or visit the docker command-line reference for the container ls command for a list of accepted options with their respective descriptions.

    While ls only lists running containers, the -a option lists all containers.

    Regards,
    -Chris

  • Hi @chrispokorni, I think that's what is bothering me. All containers are running but still only show up with ls -a.

  • chrispokorni
    chrispokorni Posts: 2,340

    Hi @PeterCharuza,

    What method did you follow to install Docker on OpenSUSE?

    Regards,
    -Chris

  • sudo zypper install docker python3-docker-compose python3

  • It's not unworkable, but it's not working as stated in the Linux Foundation course work or anything else I see online.

    For the sake of learning and completeness I figured I'd follow up and see if this is a known issue or something I'm doing wrong. It looks like it's just the wonky setup.

    Note: I don't necessarily think it's OpenSuse's fault, that is a good OS. I should just move back to VMware, I was running OpenSuse because that's the only thing that will actually boot on this older IBM ThinkCenter desktop I got for free. I'll have to think of some better way to utilize it, it's not really rocking the whole docker thing.

    Manufacturer: LENOVO
    Product Name: 0967B4U
    Version: ThinkCentre M72e
    Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz

  • How funny, I moved over to KDE Neon which is Ubuntu 20.04, installed the latest Docker (it was a breeze to setup) and I see the same results. When running docker container ls I get no output.

    pch@docker:~/.ssh$ sudo docker container ls
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

    pch@docker:~/.ssh$ sudo docker container ls -a
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    0f3b19346f28 alpine "sh" 44 seconds ago Exited (130) 10 seconds ago myalpine

    docker -v

    Docker version 20.10.8, build 3967b7d

  • chrispokorni
    chrispokorni Posts: 2,340

    Hi @PeterCharuza,

    From what I can see, the ls and ls -a commands behave as expected.

    Your container is in Exited state, no longer a running container, hence only displayed by the ls -a command. If it were a running container, it would be displayed by the ls command as well.

    Regards,
    -Chris

  • ah ok. Thanks for that :) I figured it was something I was overlooking.

Categories

Upcoming Training