First Exploration with GNU/Linux
To start the container, type the following command in the terminal:
docker start ics-vm
This command will start the container with name ics-vm
, which is created by us. By defualt, ics-vm
will start in detach mode, running the SSH deamon instructed at the end of the Dockerfile. This means we can not interact with it directly. To login the container, we should do the SSH configuration first.
SSH configuration
According to the type of your host operating system, you will perform different configuration. The first thing to do is to determine the IP address of the machine over which the docker deamon runs.
- If your host is GNU/Linux, you will use the local loopback IP address
127.0.0.1
. - If your host is Windows or Mac, the IP address is the one you remembered when you start the
Docker Quickstart Terminal
.
For GNU/Linux and Mac users
You will use the build-in ssh tool, and do not need to install an extra one. Open a terminal, run
ssh -p 20022 username@ip_addr
where username
is the user name you told Dockerfile when building the image, ip_addr
is the IP address mentioned above. For example:
ssh -p 20022 jack@192.168.99.100
If you are prompted with
Are you sure you want to continue connecting (yes/no)?
enter "yes". Then enter the user password you told Dockerfile when building the image. If everything is fine, you will login the container via SSH successfully.
For Windows users
Windows has no build-in ssh
tool, and you have to download one manually. Download the latest release version of putty.exe here. Run putty.exe
, and you will see a dialog is invoked. In the input box labeled with Host Name (or IP address)
, enter the IP address mentioned above, and change the port from 22
to 20022
. Leave other settings default, then click Open
button. Enter the container user name and password you told Dockerfile when building the image. If everything is fine, you will login the container via SSH successfully.
First exploration
After login via SSH, you will see the following prompt:
username@hostname:~$
This prompt shows your username, host name, and the current working directory. The username should be the same as you set in the Dockerfile before building the image. The host name is generated randomly by Docker, and it is unimportant for us. The current working directory is ~
now. As you switching to another directory, the prompt will change as well. You are going to finish all the experiments under this environment, so try to make friends with terminal!
Many of you always use operating system with GUI, such as Windows. The container you just created is without GUI. It is completely with CLI (Command Line Interface). As you entering the container, you may feel empty, depress, and then panic...
Calm down yourself. Have you wondered if there is something that you can do it in CLI, but can not in GUI? Have no idea? If you are asked to count how many lines of code you have coded during the 程序设计基础 course, what will you do?
If you stick to Visual Studio, you will never understand why vim
is called 编辑器之神. If you stick to Windows, you will never know what is Unix Philosophy. If you stick to GUI, you can only do what it can; but in CLI, it can do what you want. One of the most important spirits of young people like you is to try new things to bade farewell to the past.
GUI wins when you do something requires high definition displaying, such as watching movies. But in our experiments, GUI is unnecessary. Here are two articles discussing the comparision between GUI and CLI:
Now you can see how much disk space Debian occupies. Type the following command:
df -h
You can see that Debian is quite "slim".
Installing a Windows operating system usually requires much more disk space as well as memory. Can you figure out why the Debian operating system can be so "slim"?
To shut down the container, first type exit
command to terminate the SSH connection. Then go back to the host terminal, stop the container by:
docker stop ics-vm
And type exit
to exit the host terminal.