Docker Tutorial for Beginners – What is, Architecture, Install, Commands

  • Post author:
Download PDF
Advertisement

Docker Tutorial For Beginners

Docker Tutorial for Beginners – Docker Hub is a service for finding and sharing container images with your team, provided by Docker. Here are some steps for docker beginers.

Step 1: Sign up for Docker Hub

To sign up start by creating an account.

Step 2: Create your first repository

To create a repository:

  1. Sign in to the Docker Hub
  2. On the Docker Hub welcome page, Click on Create Repository:
  3. Docker Tutorial for Beginners
  4. Name the repository ** /my-first-repo** as shown in below figure. Select **Private** option:
  5. Docker Tutorial for Beginners 2
  6. You’ve created your first repository. You should see:

Docker Tutorial for Beginners 3

Step 3: Download and install Docker Desktop

To build and push a container image to Docker Hub we’ll need to download Docker Desktop.

  1. Download and install the Docker Desktop. If you are on Linux, download Docker Engine – Community
  2. Open the terminal and sign in to Docker Hub on your computer by running docker login commond.

Step 4: Build and push a container image to Docker Hub from your computer

Now start by creating a Dockerfile to specify your application as shown below.

Advertisement

   cat > Dockerfile <<EOF
   FROM busybox
   CMD echo "Hello world! This is my first Docker image."
   EOF

 

  1. To build your Docker image, run docker build -t <your_username>/my-first-repo
  2. To test your docker image localy, run docker run <your_username>/my-first-repo.
  3. To push your Docker image to Docker Hub, run docker push <your_username>/my-first-repo.

You should see output similar to the below figure:

Docker Tutorial for Beginners 4

And in Docker Hub, now your repository should have a new latest tag available under Tags:

Docker Tutorial for Beginners 5

You’ve successfully:

  • Signed up for Docker Hub
  • Created your first repository
  • Built a Docker container image on your computer
  • Pushed it to Docker Hub

 

Read More Docker Hub

Advertisement