70 %
Chris Biscardi

Surviving Docker for JS developers

  1. Installing Docker for Mac (and other approaches)
  2. Running your first container
  3. What does it mean to run a container?
  4. What can we run? (Docker Hub images, alt registries)
  5. Running containers on ports
  6. Running containers with volumes

Installing Docker for Mac (and other approaches)

Installing docker for mac, going through the settings and such briefly

Running your first container

Docker gives you this command to run from Docker for Mac.

docker run -d -p 80:80 docker/getting-started
Alias tip: d run -d -p 80:80 docker/getting-started
Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started
cbdbe7a5bc2a: Pull complete
85434292d1cb: Pull complete
75fcb1e58684: Pull complete
2a8fe5451faf: Pull complete
42ceeab04dd4: Pull complete
bdd639f50516: Pull complete
c446f16e1123: Pull complete
Digest: sha256:79d5eae6e7b1dec2e911923e463240984dad111a620d5628a5b95e036438b2df
Status: Downloaded newer image for docker/getting-started:latest

It doesn't look like it does anything but it pulls the image, creates a container, starts the container, and daemonizes it. If we look at Docker for Mac, we can see it running along with some logs, etc.

You can continue to use the GUI with the caveat that you can't do everything with the GUI. We'll be covering the CLI in this course.

What does it mean to run a container?

"running a container" involves many steps. When we do a docker run docker first needs to check to see if the image to create the container from is available locally. If it's not, the docker engine will pull the image to your computer before creating and starting a container based on that image.

We just said we can start containers, so can we stop them?

docker stop 54d2062e

What happens when we stop them? How do we restart them?

docker start 54d2062e

What can we run? (Docker Hub images, alt registries)

By default, Docker Hub owns the default namespace. This means if we go to Docker Hub we can find the list of official images. These images are often databases, but also contain different language and frameworks like Golang or node.js to different applications like WordPress.

images are tars

docker save/docker load

Possible sub-courses

  • Dockerfiles and how to use them (basic commands?)
  • Running postgres in Docker (.entrypoint scripts, etc)
  • Working with the Docker socket