Docker Con 2020

Docker Con 2020


Getting Started With Docker

The story of never-ending installation & configuration and docker to the rescue

Why Docker?

  1. Individual machines and operating systems need to be configured and upgraded. On top of that infrastructure, runs the application code

  2. Machine configuration and upgrades are extremely error prone, servers were missed or misconfigured

Containers

Docker containers to the rescue

Deployment

Writing Dockerfile

FROM - tells docker to pull down the base image
WORKDIR - the directory where your application lives
ENV - the environment variables in your image

Writing

Building a docker container

$ docker build --help
$ docker build --tag <tag name> <path to the directory to build>

This builds an image called hello-world using the current directory Building

Listing docker images

$ docker images

Running a docker container

A container is a process that’s isolated from the rest of the system. By default, your container is run in isolation:

$ docker run --help
$ docker run <name of the image>

For a previously run image, you can use

$ docker start <container>

If you don’t map out a port, and connect it to any network, in the browser when you connect to it, you won’t be able to connect.

Diagnostics - to see if anything is running

List any running image

$ docker ps

List any image that was previously run, but has stopped

$ docker ps -a

isolation

Connect a port into your image

Now you’re connected to the world on port 8080. To further debug

$ docker logs <name of the container>
$ docker logs -f <name of the container>

-f follows the logs locally connected

Publishing your image

$ docker tag <image> <username>/<repo name>
$ docker push <username>/<repo name>

publish

Pulling and deploying