1/6
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
List docker images
docker images/docker image ls
List running/stopped containers
docker ps
docker ps -a
Create and run container.
docker run -d —rm —name <container-name> -p <host port:container port> <image>
Step into running container terminal
docker exec -it <container> sh
How to delete image/running container
docker rm -f <container> // stop and remove
docker rmi <img>
The command that builds custom image from Dockerfile
docker build <path-to-Dockerfile-directory> -t <name:tag>
Create a Dockerfile with the postgres image, add persistence to data.
FROM postgres
WORKDIR app
COPY ./init.sql .
# Set environment variables
ENV POSTGRES_DB=app
ENV POSTGRES_USER=appuser
ENV POSTGRES_PASSWORD=apppassword
# Expose default Postgres port
EXPOSE 5432
VOLUME /var/lib/postgresql/data
CMD [“postgres“]