0

I have a docker container (named 'clever_hugle') that already exists on my windows machine.

I want to bind my local directory c:\Users\me\Desktop\local_dir to the docker directory '\home\lat'.

From windows I do:

docker container ls

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f7c0a4258656 conda/miniconda3:latest "bash" 2days ago Up 7 minutes clever_hugle

then

docker run --name=clever_hugle -d -v c:\Users\me\Desktop\local_dir:/home/lat -p 5000:80 clever_hugle

But I get this error:

Unable to find image 'clever_hugle:latest' locally

I have already tried to find a solution for this, but I could not find anything.

Lin Du
  • 88,126
  • 95
  • 281
  • 483
RandomFellow
  • 317
  • 1
  • 9
  • Try to start it with container ID instead. docker run f7c0a4258656 arguments – GeralexGR Feb 17 '22 at 08:51
  • @GeralexGR Thanks, I just tried, I get "Unable to find image 'f7c0a4258656:latest' locally" – RandomFellow Feb 17 '22 at 08:56
  • @GeralexGR I think the problem is that "run" command can only be used to create a new container – RandomFellow Feb 17 '22 at 08:57
  • Yes indeed. You should use run to create a new container. Your image is `conda/miniconda3:latest` as a result you should run docker run conda/miniconda3:latest arguments... In order to use your existing image, you should do `docker stop f7c0a4258656`. and then `docker start f7c0a4258656` arguments. – GeralexGR Feb 17 '22 at 08:58
  • You mixed up the container name with the image name. – AymDev Feb 17 '22 at 09:03
  • @GeralexGR The problem is that on the container 'clever_hugle' I already installed a bunch of things, so I really want to keep using it (and not recreate a new container) – RandomFellow Feb 17 '22 at 09:13
  • @RandomFellow use the stop and start commands I gave you above – GeralexGR Feb 17 '22 at 09:19
  • @GeralexGR just did it, then I did: **docker run conda/miniconda3:latest -d -v ./essai:/home/essai -p 5000:80 conda/miniconda3:latest** and I got this error: "docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "-d": executable file not found in $PATH: unknown." – RandomFellow Feb 17 '22 at 09:30
  • Try `docker run --name yourname -d -v ./essai:/home/essai -p 5000:80 conda/miniconda3:latest`. Make sure the paths of -v are correct – GeralexGR Feb 17 '22 at 09:37
  • yourname ? what is it suppose to be ? the container's name ? – RandomFellow Feb 17 '22 at 09:47
  • indeed the name you want container to have – GeralexGR Feb 17 '22 at 10:03
  • but then this new container will not have the content of this container f7c0a4258656 – RandomFellow Feb 17 '22 at 10:07
  • Your work is going to be lost; especially if you've installed things it's going to be hard to extract them from a container. I'd suggest minimizing the amount of work you do in interactive shells in containers, and don't directly run base images like `conda/miniconda3`. Instead, write a Dockerfile starting `FROM` that image that `RUN`s commands to install things, and check that into source control; that will produce a reusable image. Docker's [Sample application](https://docs.docker.com/get-started/02_our_app/) tutorial has an overview of the process. – David Maze Feb 17 '22 at 11:37
  • For individual files [Docker: Copying files from Docker container to host](https://stackoverflow.com/questions/22049212/docker-copying-files-from-docker-container-to-host) might help you, but it won't know the history of things you've installed by hand or where they are. – David Maze Feb 17 '22 at 11:38
  • Container = Base image (conda/miniconda3:latest) + some manual step And you can’t reuse a container (clever_hugle) anyway. No workarounds. So what you can do if you have important files that you don’t to loose copy it from docker container (step mentioned just above). And in future create your own image (not container) using docker file. And whenever required just run the custom image. – Snigdhajyoti Feb 17 '22 at 19:16

0 Answers0