I have a problem of understanding docker or the use of a docker image.
I have run a docker image:
docker pull scrlk/esp32-micropython
docker run -it -v $(pwd):/mnt scrlk/esp32-micropython
So far so good. But how do I get into the docker image, like sitting in the directory where the files have been built into.
This way I’m still “outside” the docker image. I read something like attaching to the image. But what is the <container name> ? And I need an entrypoint like a shell or sth.?
Thanks. docker ps doesn’t show anything. docker imagesgives:
alpine:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
scrlk/esp32-micropython latest 2c53e2135141 4 years ago 1.26GB
I tried docker run -it <image> bash. But what is <image? The cited tutorial doesn’t explain what stands for. You may say that’s obvious. But a mundane like me doesn’t know it in advance.
I took the “IMAGE ID” and it worked.
When first time running the command docker run -it -v $(pwd):/mnt scrlk/esp32-micropython
a build script seems to be started. BTW, The image is ready made and I pulled it from a repo. I don’t seem to have a docker file for it. So I can’t say what actually is invoked when the image is run.
Anyway, when I execute said command docker run -it <image> bash I land in /mnt. At this point in time everything that had been invoked by the previous run is gone. That’s kind of an oddity. Also, when exiting the docker image and running again, the previously generated results are gone. Is there a was to snapshot the docker or preserve the state ?
A container is like a paper handkerchief for blowing your nose, once used and throwed (means exit),if you take a new one (create a new container), everything is “clean” again. A container is always recreated from an image and an image is immutable.
The concept of a container is crucial using Docker. I think it’ll be interessant to take time to read some tutorial.