First Exploration with GNU/Linux
Last updated
Was this helpful?
Last updated
Was this helpful?
To start the container, type the following command in the terminal:
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.
According to the type of your host operating system, you will perform different configuration.
You will use the build-in ssh
tool, and do not need to install an extra one. Open a terminal, run
where username
is the user name in Dockerfile. By default, it is ics
. If you are prompted with
enter "yes". Then enter the user password in Dockerfile. If everything is fine, you will login the container via SSH successfully.
Windows has no build-in ssh
tool, and you have to download one manually. Download the latest release version of putty.exe
. Run putty.exe
, and you will see a dialog is invoked. In the input box labeled with Host Name (or IP address)
, enter 127.0.0.1
, and change the port to 20022
. To avoid entering IP address and port every time you login, you can save these information as a session. Leave other settings default, then click Open
button. Enter the container user name and password in Dockerfile. If everything is fine, you will login the container via SSH successfully.
After login via SSH, you will see the following prompt:
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?
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:
You can see that Debian is quite "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:
And type exit
to exit the host terminal.
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 . 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.