Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Error: No such container: friendlyhello

Tags:

docker

I'm trying to stop and remove a docker - container.

I started with docker turorial part1, now part2 from here: https://docs.docker.com/get-started/part2/#run-the-app

I copied souce from there. and its also available here: https://gist.github.com/sl5net/8b510bc0d3e00c474575e010003406c1

Here you could see how my console looks like:

Microsoft Windows [Version 10.0.16299.431] C:\fre\private\docker\test18-05-14_05-27>docker build -t friendlyhello . Sending build context to Docker daemon   5.12kB no matching manifest for windows/amd64 in the manifest list entries 

BTW solution: I swaped to linux container (right click>contextmenu on docker icon)

C:\fre\private\docker\test18-05-14_05-27>docker build -t friendlyhello . ... Successfully built itsdangerous MarkupSafe Successfully tagged friendlyhello:latest  C:\fre\private\docker\test18-05-14_05-27>docker run -p 4000:80 friendlyhello  * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)  C:\fre\private\docker\test18-05-14_05-27>docker image ls REPOSITORY          TAG                 IMAGE ID            CREATED    SIZE friendlyhello       latest              7d4d1e0f78e6        8 minutes ago    151MB python              2.7-slim            46ba956c5967        9 days ago    140MB  C:\fre\private\docker\test18-05-14_05-27>docker container stop friendlyhello Error response from daemon: No such container: friendlyhello  C:\fre\private\docker\test18-05-14_05-27>docker rm -f friendlyhello Error: No such container: friendlyhello 
like image 524
SL5net Avatar asked May 14 '18 04:05

SL5net


People also ask

How do I remove all images from docker?

Remove all Containers: To remove all containers from the docker-machine, we need to get the ids of all the containers. We can simply get the ids of the containers with the command docker ps -aq, then by using the docker rm command, we can remove all the containers in the docker-machine.

How can I see all docker containers?

In order to list the Docker containers, we can use the “docker ps” or “docker container ls” command. This command provides a variety of ways to list and filter all containers on a particular Docker engine.


2 Answers

There is no container available with the name friendlyhello as you are simply running the container using docker run -p 4000:80 friendlyhello, here friendlyhello is the name of the image, and not the container's name.

Either run that container by giving it a name like below:-

docker run -p 4000:80 --name SOMENAME friendlyhello 

In this case you will be able to stop and remove that container using the below command

# container stop docker container stop SOMENAME  # container removal docker rm -f SOMENAME 

Or if not running without giving a name to the container, you will have to use the ID of the container in the commands to stop and remove, even in various other commands you will be using the ID to refer that con

like image 95
kakabali Avatar answered Oct 08 '22 13:10

kakabali


The tutorial shows:

$ docker container ls CONTAINER ID        IMAGE               COMMAND             CREATED 1fa4ab2cf395        friendlyhello       "python app.py"     28 seconds ago 

You haven't added a name (tag) to your container, so you must use its ID to stop it:

docker container stop 1fa4ab2cf395 

friendlyhello is the name of the image, not the container.

See docker run --name to give it a name.

If you don't have a name, you will the ID with docker ps -a

The OP adds:

using docker stop 8e008ebf3ad7 its out of list using: docker container ls buts stays in list using: docker ps -a

docker stop 8e008ebf3ad7 8e008ebf3ad7 docker container ls CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                NAMES 5227976cb9bb        friendlyhello       "python app.py"     About an hour ago   Up About an hour    0.0.0.0:4001->80/tcp   SOMENAME  docker ps -a CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS      PORTS                  NAMES 5227976cb9bb        friendlyhello       "python app.py"     About an hour ago   Up About an hour      0.0.0.0:4001->80/tcp   SOMENAME 8e008ebf3ad7 friendlyhello "python app.py" 6 hours ago Exited (137) About an hour ago  

That is expected: a stop will put a container in an "Exited" state, which is handy when you want to debug a container which stopped without your consent!

You can then do a docker container rm <ID> in order to reomve it from the docker ps -a list.

Note that if you had launch your container with docker run --rm ..., a stop would have stopped and removed (deleted) the container directly.

like image 20
VonC Avatar answered Oct 08 '22 13:10

VonC