Push Docker image to self-hosted registry
Steps on building a Docker image and pushing it to a self-hosted registry:
- Build the Docker image using
docker build. - Run
docker loginto log in to the registry. - Tag the image to the registry using
docker tag. - Push the image to the registry using
docker push.
Putting it together in an example:
# Build the image
docker build -t app:1.0.0 .
# Log into the registry
docker login example.com
# Tag the image to the registry
docker tag app:1.0.0 example.com/app:1.0.0
# Push the image to the registry
docker push example.com/app:1.0.0
This will create an image with the name example.com/app:1.0.0 being pushed to the registry.