docker error - 'name is already in use by container'

后端 未结 18 2080
暖寄归人
暖寄归人 2020-12-12 08:14

Running the docker registry with below command always throws an error:

dev:tmp me$ docker run \\
     -d --name registry-v1 \\
     -e SETTINGS_         


        
18条回答
  •  感情败类
    2020-12-12 09:03

    Ok, so I didn't understand either, then I left my pc, went to do other things, and upon my return, it clicked :D

    1. You download a docker image file.

    2. 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).

提交回复
热议问题