Docker Community Forums

Share and learn in the Docker community.

Where are docker image files (localhost)

#1

I’m trying to create an image and a container to run a small project locally in my Ubuntu 18.04 however, I’m encountering many difficulties to find where the generated files are after the image is created.

First, when creating the image and the container, I have no idea where the files will stop. How do I add or remove files manually if I want to do so after creating the image and the container?

My DOCKERFILE code is as follows:

FROM node:alpine
COPY . /wd
RUN cd /wd && npm install && npm run build

FROM node:alpine
COPY --from=0 /wd/dist /
RUN mkdir -p /data/student && mkdir -p /data/screen
CMD node /server

EXPOSE 8080

And, to run the image, I’m using the following command:

sudo docker run -d
–name students-school
-p 8080:8080
-v ~/data/students:/data/students
-v ~/data/screen:/data/screen
test/student-school

Thanks for any help.
Cheers!

(Metin Y.) #2

Seems like you didn’t fully understand the concept of images and the layers it consists of.

Changes are done on your Dockerfile. After a change the Dockerfile needs to be build and the image run. You don’t like the resulting image? Then start the cycle again by modifiying your Dockerfile, building a new image and create a container from the image. Repeat until you like the result.

#3

Hi, @meyay!

Thanks for answering.

What happens, is that I took an image in the Docker Hub and until then, all right, I can run the image, the container, execute everything correctly, etc.

However, I would like to make modifications to the codes that are in the container, directly accessing the local directory and editing directly in an atom or vs code editor … But for that, I would like to access the files physically.

Is it possible to do this in the case of images and docker containers? The image I downloaded from the Docker Hub is: docker pull nfam / nes-web

Cheers!

(Metin Y.) #4

Are you aware that in the description of most images, a link to the source repo of the imagae is available? In your case: https://github.com/nfam/nes-web

Regarding your changes: clone the git repo, do your changes, build an image with your modifications & start you container.

Good luck on your journey!

#5

@meyay

Yes, I’m aware.
What’s new in specific, the github repository does not contain all the files needed for the application to work in full, just doing the dockerhub pull works locally and a small feature on the networks connected to the internet due to a selection of files inside in container.
I’ll keep trying and I’ll relate here.
Thank you!