Docker and Docker Compose
The project in this course (and some other work) can be deployed in containers managed by Docker and Docker Compose.
Getting Set Up: your computer
You should be able to install and run Docker and Docker Compose on any operating system.
- Install Docker. Methods very by operating system: searching for up-to-date instructions will likely be more reliable than anything I can post here. In particular, see Docker's Ubuntu installation instructions.
- Install Docker Compose. If you have installed a full Docker Desktop version, it should be there. If you installed a Linux package, you likely also have to install the
Getting Set Up: CSIL Linux
Everything you need should be available on the Linux side of any of the CSIL workstations. You can use the
docker commands as expected.
Please be cautious of your disk usage in CSIL. When you're done, clean things up with:
docker-compose down docker system prune --volumes
Getting Set Up: CSIL Linux Remotely
As above, the tools you need should be available on CSIL Linux machines. That includes
csil-cpu4.csil.sfu.ca, which you can connect to remotely with this command (or your SSH client's adaptation of it):
ssh -p24 -L 8080:localhost:8080 csil-cpu4.csil.sfu.ca
This will forward port 8080 from there to your localhost: adapt as necessary to get the port(s) you're using for your HTTP server.
Working with Containers
Here are a few basic commands to get started working with
- Build any images from
Dockerfiles described in your
- Start all of the containers described in your
docker-compose.yml. Press control-C to stop them.
- Stop and remove all of the containers described in your
docker system prune
- Remove any unused containers and images.
docker system prune --volumes
- As above, but also remove any volumes.
docker-compose run app bash
- Run a command (
bash) in a new instance of the container (
docker exec -it exercise4_web_1 bash
- Run a command (
bash) in an existing container (