Lab 0 - (Part 1) Lab Environment Setup
Lab 0 - (Part 1) Lab Environment Setup
Lab 0 - Part 1
Setting up the lab environment
Welcome to the first lab! The main focus will be to get you set up with the tools we’ll be using throughout all
the labs, and give you an intuitive understanding of each one.
The main tools we’ll be using are Docker, a convenient way to manage virtual environments as “containers”,
and Git, the most prominent version control software.
1 | Tool | Use |
|------------|--------------------------------------------|
2
| Docker | Software environment virtualization |
3
| Git | Version control software |
4 | GitHub | Online code storage and version control|
5
Docker
Docker is one of the most popular container solutions and widely used in industry. Follow the instructions
here to install Docker in your Ubuntu. It is recommended to follow the installation method using apt repository.
Verify Docker is installed by executing the following command in a terminal:
$ docker --version
$ docker info
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon
running?
it means Docker hasn’t started running yet. On Linux, try the command sudo systemctl docker restart in a
terminal.
Task
1. Enter the directory on your computer where you want to do your coursework.
Then, enter the following command to download the development environment to the new
subdirectory DEV-ENVIRONMENT (you can choose your own name, DEV-ENVIRONMENT is a placeholder!):
This command clones a GitHub repository onto your computer; we will explain the details of Git and cloning
later in the lab.
2. Run cd DEV-ENVIRONMENT to enter the directory you have just created.
3. Inside this folder, do the following:
./cs300-build-docker builds your docker image, which may take a while. It’s normal for this script to run for
around 20-30 minutes.
Task
Enter your container and explore it by running a few commands. Then, exit the container by exit , or Ctrl-D.
Make sure you’re inside directory DEV-ENVIRONMENT when running the command below.
Don’t worry if the number after cs300-user is different. This is an identifier that uniquely identifies this
container.
You may run any Linux commands inside this container. To exit, enter exit or use Ctrl-D.
Shared Folders
“If my docker container is a separate (virtual) computer than my laptop, how will I move files between the
two?”, you may ask. Great question! You’ll move files between the two in any of the ways you can move files
between any two computers! (Bear with us!)
To get files to and from department machines, you may have used things like scp , sftp , and Cyberduck,
which allow you to copy files over the network. These work, but are inconvenient if you’re constantly moving
them back and forth. (Git would technically also fall under this category, even though it’s fancier, as you’ll find
out shortly.)
If you’re lucky, you may have been exposed to FUSE and sshfs , which allow you to mount a filesystem over
the network. This allows your computer to navigate the remote files as if they were stored locally, which
means any changes you make are happening on both ends automatically.
Inside of the container, your home directory ( /home/cs300-user , or ~ ) is actually a mount of
the home directory inside your DEV-ENVIRONMENT directory. Any changes you make in one will be visible in the
other.
Task
Outside of the container, go into your [DEV-ENVIRONMENT]/home folder, and create a file and a folder. Then, go
into your container, delete that file, and add a file to the folder. This is so you get a feel for what is going on,
since you’ll be using this on a regular basis!
Step-by-step guide
$ touch cool_file
$ mkdir awesome_folder
$ cd ..
$ ./cs300-run-docker
cs300-user@9899143429a2:~$ rm cool_file
cs300-user@9899143429a2:~$ cd awesome_folder
cs300-user@9899143429a2:~$ touch even_cooler_file
cs300-user@9899143429a2:~$ exit # or just CTRL-D
Your Docker container will still try to mount to the original dev-environment path, even after you rename,
remove, or move the folder DEV-ENVIRONMENT .
After moving your dev-environment folder, you’ll need to delete the old container and start a new container.
You can do so with:
./cs300-run-docker --clean
You should be able to enter a container, and see all of your work now!
End
That'd be all for Part-1 of lab 0. Part-2 will be released during lab time. You must complete all the steps from
this part before coming to the lab.