Docker Fundamentals Flashcards
1
Q
What are the main components of a dockerfile?
A
- Base image
FROM python:3.8.3-slim-buster - Copy files
COPY . /src - Install dependencies
RUN pip install -r /src/requirements.txt
1
Q
How do you create a new docker image?
A
Create a dockerfile or run docker init
, then do docker build -t your-app-name .
and then docker up -p 8080:8080 your-app-name
2
Q
How do you stop a running docker container?
A
docker stop your-image-name
3
Q
How do you check the currently running docker images?
A
docker ps
4
Q
How do you enter a docker container and start a interactive shell?
A
docker exec -it my_container /bin/bash
5
Q
A