In this video, CJ shows hands on examples of when and where you can start using docker in your apps. He shows usage of the docker CLI, Docker Desktop, docker compose and shows how to create a custom image with a Dockerfile. To demonstrate these tools, he shows how to start a redis and postgres database using the official docker images. He also shows how to spin up these containers with docker compose, and finally shows how to containerize an existing application.
Follow along with the first example here: https://github.com/w3cj/pokemon-cacher Follow along with the second example here: https://github.com/w3cj/backpack-debuggers
00:00 Intro
00:13 Docker Desktop Alternatives
00:50 How do we run a redis database locally?
01:39 Simple Example API Setup
02:30 Run an image with the docker CLI
06:21 docker CLI commands
08:50 A simple docker compose example
11:45 More complex example API setup
15:41 docker compose example with postgres
17:48 Persisting data with docker volumes
21:51 The case for custom images and containerization
23:32 Creating a custom image with a Dockerfile
30:02 Ignoring files with .dockerignore
31:03 Examine container files and execute commands with Docker Desktop
32:31 Run migrations and seeds from within the container
33:58 Make code changes without re-building image
34:55 Create a volume for node_modules to prevent internalBinding errors
36:35 Better development workflow with devcontainers
38:03 Optimize docker layer order for faster builds
40:09 Create a multi-stage Dockerfile for dev, build and prod
46:23 Share docker-compose.yml configurations
48:41 Thanks!
Overview of Docker Desktop: https://docs.docker.com/desktop/
Docker Desktop license agreement: https://docs.docker.com/subscription/desktop-license/
docker CLI reference: https://docs.docker.com/reference/cli/docker/
docker container CLI reference: https://docs.docker.com/reference/cli/docker/container/
docker exec reference: https://docs.docker.com/reference/cli/docker/container/exec/
docker compose CLI reference: https://docs.docker.com/compose/reference/
docker-compose.yml file reference: https://docs.docker.com/compose/compose-file/
extending your docker compose file: https://docs.docker.com/compose/multiple-compose-files/extends/
.dockerignore file reference: https://docs.docker.com/build/building/context/#dockerignore-files
Dockerfile reference: https://docs.docker.com/reference/dockerfile/
Multi-stage builds reference: https://docs.docker.com/build/building/multi-stage/
Docker layers reference: https://docs.docker.com/build/guide/layers/
Devcontainers: https://code.visualstudio.com/docs/devcontainers/containers
How to use the node.js image: https://github.com/nodejs/docker-node/blob/main/README.md#how-to-use-this-image
Docker hub images used in this video:
Redis: https://hub.docker.com/_/redis
Postgres: https://hub.docker.com/_/postgres/
node: https://hub.docker.com/_/node/
Docker desktop alternatives:
Podman Desktop: https://podman-desktop.io/
Rancher Desktop: https://rancherdesktop.io/
Orbstack: https://orbstack.dev/
Colima: https://github.com/abiosoft/colima
Redis links:
Install redis: https://redis.io/docs/install/install-redis/
Redis cloud: https://redis.com/cloud/pricing/