Introducing the Docker command line
OverviewTeaching: 10 min
Exercises: 0 minQuestions
How do I interact with Docker?Objectives
Explain how to check that Docker is installed and is ready to use.
Demonstrate some initial Docker command line interactions.
Docker command line
Start the Docker application that you installed in working through the setup instructions for this session. Note that this might not be necessary if your laptop is running Linux.
The Docker application will usually provide a way for you to log in using the application’s menu (macOS) or systray icon (Windows). This will require you to use your Docker Hub username and your password.
Determining your Docker Hub username
If you no longer recall your Docker Hub username, e.g., because you have been logging into the Docker Hub using your email address, you can find out what it is through the steps:
- Open http://hub.docker.com/ in a web browser window
- Sign-in using your email and password (don’t tell us what it is)
- In the top-right of the screen you will see your username. Mine’s
Now open a shell window, and run the following command in your shell to check that Docker is installed. I have appended the output that I see on my Mac, but the specific version is unlikely to matter much: it certainly does not have to precisely match mine.
$ docker --version
Docker version 18.09.1, build 4c52b90
Ensure that your command line
docker commands are able to reach the Docker Hub by running the following command:
$ docker login
Authenticating with existing credentials... Login Succeeded
(I wasn’t prompted for authentication details, if you are, then you need to use your Docker Hub username and password.)
Login Succeeded message means that your
docker command line tool is ready to access the Docker Hub. We will return to discussion of the Docker Hub soon…
A toolbar icon indicates that Docker is ready to use containers.
You will typically interact with Docker using the command line.