Docker – login and push to Hub

  1. Login to docker
$ docker login --username=YOUR_USERNAME

2. Start by creating a Dockerfile to specify your application as shown below:

# syntax=docker/dockerfile:1
FROM busybox
CMD echo "Hello world! This is my first Docker image."

3. To build your Docker image:

docker build -t <your_username>/my-private-repo .

4. Test your Docker image locally:

docker run <your_username>/my-private-repo

5.  Push your Docker image to Docker Hub. You should see output similar to:


Similar Posts