Build an Image with Docker and Push to a Container Registry - kimschles/schlesinger-knowledge GitHub Wiki
Prereqs:
- Docker is installed and running on your machine
- Check with
docker --version
- Get fancy with
docker info
- Check with
- Build an app and create a Dockerfile
- Create a Docker image
-
In the directory for your app run
docker build -t <nameofimage> .
-
Test that it's working by creating a container locally
docker run -p 4000:80 <nameofimage>
-
Login in your registry
- For Dockerhub:
docker login
- For DOCR:
doctl registry login
-
Tag your image with your registry and repo name
docker tag <my-image> registry.digitalocean.com/<my-registry>/<my-image>:tag
-
Upload your image to your registry
docker push registry.digitalocean.com/<my-registry>/<my-image>
-
Repeat and update the tag when a change is made
-
Have a cookie.