Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Creating Your Own Docker Image

Docker Hub provides many useful, pre-made images which you can use for a variety of applications. However, if you want to use Docker in the real world, you will likely be required to design and build your own Docker images, either to customize existing images or to run your own software. In this lab, you will have the opportunity to work with Docker images by designing your own image to a set of specifications using a Dockerfile. You will then be able to run a container using your image to verify that it works.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon May 03, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create a Dockerfile to define the image and build it.

    1. Change to the project directory and create a Dockerfile.
    cd ~/fruit-list
    vi Dockerfile
    
    1. Build a Dockerfile that meets the provided specifications.
    FROM nginx:1.15.8
      
    ADD static/fruit.json /usr/share/nginx/html/fruit.json
    ADD nginx.conf /etc/nginx/nginx.conf
      
    EXPOSE 80
      
    CMD ["nginx", "-g", "daemon off;"]
    
    1. Build the image.
    docker build -t fruit-list:1.0.0 .
    
  2. Challenge

    Run a container with the image in detached mode and verify that it works.

    1. Run a container in detached mode using the newly-created image.
    docker run --name fruit-list -d -p 8080:80 fruit-list:1.0.0
    
    1. Make a request to the container and verify that you get some JSON with a list of fruits.
    curl localhost:8080
    

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans