- Install Docker Desktop (version 3.0+). For Windows, we recommend setting up WSL2.
- Copy
docker-compose.yml
to your course projects folder.
If your CPU is in AMD64 Architecture, in other words, if your CPU is not Apple M1, then do the following.
- Run
docker pull cis548/docker-env
to will pull the docker image from Docker Hub repository. - Run
docker-compose run --rm mcit
to launch a Docker Container.
--rm
will clean up the container when it is finished.- The home directory
/home/cit595
, also known as~
, is synchornized with the folder, where you put thedocker-compose.yml
, in your Host System.
You should now be inside your docker image, with current folder at /home/cit595
. You can use pwd
to check.
You will log into the container as user cit595
with password mcit
. The password is used just in case you occationally need sudo previlege.
If you are using a machine with Apple M1 CPU, you need to do a few extra steps to compile the docker image locally.
- Copy
Dockerfile
to your course projects folder along withdocker-compose.yml
- Run
docker-compose build mcit
to compile the docker image locally. - Follow For AMD64 Architecture section, starting from the second step. In other words, run
docker-compose run --rm mcit
to launch a Docker Container.
Just open your course projects folder, and run docker-compose run --rm mcit
.
To establish multiple sesssion to the same
container, call docker exec -it [container_id] bash
after booting the first window with docker-compose run mcit
.
The following is the offical definition of docker-compose:
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
In CIT 595, we only use docker-compose
to start one service which is your virtual machine. But docker-compose
make the command consice and convient because we can predefine the configuration in docker-compose.yml
.
If we use the bare-mental docker
to start the container with same configuration, you have to run
docker run -it --rm -v `pwd`:/home/cit595 cis548/docker-env
If we use docker-compose
, it runs container with -it
by default. The volume mounting is configed in docker-compose.yml
under mcit
service. So we only need to call docker-compose run --rm mcit
.
This is why we choose to use docker-compose
, but the overhead is you have to prepare a docker-compose.yml
file.
Vim is installed in the Docker container. We prepared a Vim configure file for students who would like to explore. The configuration file helps to install plug-ins and theme to make Vim more user-friendly and powerful. To use the configuration file, first use docker-compose run --rm mcit
to get into the container. Then do the following two steps.
# Step 1: Download the configuration file from CIS548
wget -O .vimrc https://raw.githubusercontent.com/CIS548/gists/master/example_vimrc.txt
# Step2: Update Vim based on the configuration files
vim -es -u vimrc -i NONE -c "PlugInstall" -c "qa"
Now you are ready for Vim!
Docker Image in DockerHub (Link)
We use docker buildx
to generate images for AMD64 and ARM64 CPUs. The steps are as follows.
- Create a new builder. The default docker builder does not support multi-platform compiling, so we need to create a new one. Here we name it
mybuilder
.
docker buildx create --name mybuilder
- Set
mybuilder
as the new default builder and double-check the change is in effect.
docker buildx use mybuilder
docker buildx inspect --bootstrap
- Build and push the images to
cis548/docker-env
. To push images to the Docker Hub reposiotry, make sure you have the right permissons to the repo.
docker buildx build . --platform=linux/amd64,linux/arm64/v8 -t cis548/docker-env:latest --push
# change :latest to another tag if necessary
- To learn more, the following sections in this YouTube video gives a step-by-step demo.
- An example of running docker image with a specific platform
docker run -it --rm --platform linux/arm64 cis548/docker-env