Running the docker
registry with below command always throws an error:
dev:tmp me$ docker run \\
-d --name registry-v1 \\
-e SETTINGS_
The Problem: you trying to create new container while in background container with same name is running and this situation causes conflicts.
The error would be like:
Cannot create continer for service X :Conflict. The name X is already in use by container abc123xyz. You have to remove ot delete (or rename) that container to be able to reuse that name.
Solution rename the service name in docker-compose.yml
or delete the running container and rebuild it again (this solution related to Unix/Linux/macOS systems):
sudo docker ps -a
sudo docker stop <container_id>
sudo docker rm <container_id>
or
sudo docker rm --force <container_id>
Ok, so I didn't understand either, then I left my pc, went to do other things, and upon my return, it clicked :D
You download a docker image file.
Now, you use docker run, and give it a name (e.g: newWebServer).
docker run -d -p 8080:8080 -v --name newWebServer new/webserver-image
OK. So now, docker run just created a container from your image. If it isn't running, you can now start it with it's name:
docker start newWebServer
You can check all your containers (they may or may not be running) with
docker ps -a
You can stop and start them with their name or the container id from the CONTAINER ID column now e.g:
docker stop newWebServer
docker start c3028a89462c
And list all your images, with
docker images -a
In a nutshell, download an image; docker run creates a container from it; stop it with docker stop (name or container id); start it with docker start (name or container id).
TL:DR;
List all containers:
docker ps -a
Remove the concerned container by id:
docker container rm <container_id>
Simple Solution: Goto your docker folder in the system and delete .raw file or docker archive with large size.
The OP's problem is the error. Deleting state isn't the only solution - or even a good one. The problem is docker run
isn't re-entrant, and docker start
is impotent w/o run
. So we have to combine them.
For example to run Postgres w/o destroying previous state, try this:
docker start postgres || docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=password postgres:13-alpine
Here what i did, it works fine.
docker ps -a
docker rm name_of_the_docker_container