Make a Docker Whale Speak

DockerDockerBeginner
Practice Now

Introduction

Ahoy, Docker explorer! You've mastered running your first container, and now it's time for some nautical fun. In this challenge, you'll make a Docker whale speak by running a command inside a container. Get ready to dive deeper into the ocean of containerization!


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL docker(("Docker")) -.-> docker/ContainerOperationsGroup(["Container Operations"]) docker/ContainerOperationsGroup -.-> docker/run("Run a Container") subgraph Lab Skills docker/run -.-> lab-388948{{"Make a Docker Whale Speak"}} end

Run a Container and Make It Speak

Tasks

Your mission, should you choose to accept it, is:

  1. Run a Docker container that can generate ASCII art of a talking whale.
  2. Make the whale say "Ahoy, Docker"

Requirements

To successfully complete this challenge, you must:

  1. Use the docker run command to start the container.
  2. Use the image docker/whalesay.
  3. Use the cowsay command inside the container to make the whale speak "Ahoy, Docker".
  4. Execute the command in the ~/project directory.

Hints

To run a command inside a Docker container as you start it, you can append the command after the image name in your docker run command. The general structure is:

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

In this case, you'll want to run the cowsay command with your desired message as an argument.

Example

When you successfully complete the challenge, you should see output similar to this:

 ______________
< Ahoy, Docker >
 --------------
    \
     \
      \
                    ###        .
              ### ### ###       ==
           ### ### ### ###      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/
โœจ Check Solution and Practice

Summary

Congratulations, captain! In this challenge, you've sailed into new Docker waters by not only running a container but also executing a command inside it. You've used the docker run command to start a container from the docker/whalesay image and made it generate a speaking whale ASCII art.

This exercise builds on your basic Docker skills and introduces the concept of running commands inside containers. You've learned that containers can do more than just run with their default settings - they can accept commands to perform specific tasks.

As you continue your Docker journey, remember that this pattern of running containers with specific commands is a fundamental skill in containerization. It allows you to use containers flexibly for various tasks, from generating ASCII art to running complex applications. Keep exploring, and may your Docker adventures be whale-y exciting!