Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

Docker Error: No such container: friendlyhello

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:freprivatedockerest18-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:freprivatedockerest18-05-14_05-27>docker build -t friendlyhello .
... Successfully built itsdangerous MarkupSafe
Successfully tagged friendlyhello:latest

C:freprivatedockerest18-05-14_05-27>docker run -p 4000:80 friendlyhello
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)

C:freprivatedockerest18-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:freprivatedockerest18-05-14_05-27>docker container stop friendlyhello
Error response from daemon: No such container: friendlyhello

C:freprivatedockerest18-05-14_05-27>docker rm -f friendlyhello
Error: No such container: friendlyhello
question from:https://stackoverflow.com/questions/50323199/docker-error-no-such-container-friendlyhello

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...