I am new with docker.
I have the following Dockerfile and docker-compose.yml file
FROM python:3.9-alpine3.13
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./app /app
WORKDIR /app
EXPOSE 8000
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
mkdir -p /vol/web/media && \
mkdir -p /vol/web/static && \
chown -R django-user:django-user /vol && \
chmod -R 755 /vol && \
ENV PATH="/py/bin:$PATH"
USER django-user
and this docker-compose file
version: "3.3"
services:
app:
build:
context: .
args:
- DEV=true
container_name: app
ports:
- "8000:8000"
volumes:
- ./app:/app
- data:/vol/web
command: >
sh -c "python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
depends_on:
- db
db:
......
volumes:
data:
I am a bit confused on how RUN instruction work.
After running docker-compose build
and docker-compose up
commands, I have my container build. But my problem is, I accessed my app container by running $ docker exec -it app sh
command, but inside I don't see /vol/web/media
and /vol/web/static
which for me are supposed to be created during the build of Dockerfile.
Why I cannot find these two folders in my app container? where they are?
When running RUN instructions in a Dockerfile to install for example some packages, where do that packages are installed? In my Ubuntu host machine or in the file system of container?