15-441-project-1/
: source codes for the handoutDockerFile
: the script to build the docker image for this project's environment
-
install docker
-
open terminal and change working directory to this folder
-
run
export DOCKER_DIR=`pwd`
-
run
docker build -t 15441project1:latest -f ./DockerFile .
-
run
docker run -it -v $DOCKER_DIR/15-441-project-1/:/home/15-441-project-1/ --name <name_for_your_container> 15441project1 /bin/bash
-
handout codes are available at
/home/15-441-project-1/
(in the container) and<absolute_path_to_current_folder>/15-441-project-1/
(on your machine), and modify in one place will also affect the other one. That is to say, a mapping is established between the two folders, which means you can use IDE to write codes on your machine and test them in the container easily. -
In order to test your server with a browser on your machine, you need to set up port mapping for the docker container. Simply add a command line argument, such as,
-p 8888:15441
to the command in 4, and a mapping from127.0.0.1:15441
(in container) to127.0.0.1:8888
(on your machine) is established. Then you can use the URL127.0.0.1:8888
in your browser like Chrome to test your server which is bound to port 15441 in the container. -
To enable both HTTP port and HTTPS port, you need to add another mapping to the command. For example,
docker run -it -p 8888:15441 -p 9999:15641 -v $DOCKER_DIR/15-441-project-1/:/home/15-441-project-1/ --name <name_for_your_container> 15441project1 /bin/bash
. Also, do not forget to install the certificate in your browser.