First Exploration with Linux
Surf at the sea of command lines.
Last updated
Was this helpful?
Surf at the sea of command lines.
Last updated
Was this helpful?
To start the container, type the following command in the terminal:
This command will start the container with name oslab-vm
, which is created by us. By defualt, oslab-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 oslab
. 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!
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.