Docker Volumes

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

You are working on a project and need to deploy a MySQL container to the development environment. Because you will be working with mock customer data that needs to be persistent, the container will need a volume. Create a volume called mysql_data. Then deploy a MySQL container that will use this volume to store database files.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Volume Called `mysql_data`

Use the docker volume command to create a volume called mysql_data.

[cloud_user@host]$ docker volume create mysql_data
Create a MySQL Container

Use the docker container command to create a MySQL container:

[cloud_user@host]$ docker container run -d --name app-database 
 --mount type=volume,source=mysql_data,target=/var/lib/mysql 
 -e MYSQL_ROOT_PASSWORD=P4ssW0rd0! 
 mysql:latest

Additional Resources

Create a volume called mysql_data, then deploy a MySQL database called app-database. Use the mysql latest image, and use the -e flag to set MYSQL_ROOT_PASSWORD to P4sSw0rd0!. Use the mount flag to mount the mysql_data volume to /var/lib/mysql. The container should run in the background.

What are Hands-on Labs

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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!