Running Code with Docker

What is Docker?

Docker is a platform that packages applications and their dependencies into lightweight, portable containers. Think of it as a way to run software in an isolated environment that works the same on any computer.

Why We Use Docker

CodeArchaeology covers 50+ programming languages, many of which require specific compilers, interpreters, or runtime environments. Docker lets you:

  • Run any language instantly without installing compilers or SDKs
  • Avoid version conflicts between different languages or tools
  • Get consistent results regardless of your operating system
  • Clean up easily - containers leave no trace when removed

Instead of installing FORTRAN, COBOL, Pascal, and dozens of other toolchains, you simply pull a Docker image and run code.

Getting Docker

Docker Desktop is free for personal use and available for all major platforms:

PlatformDownload
WindowsDocker Desktop for Windows
macOSDocker Desktop for Mac
LinuxDocker Engine for Linux

After installation, verify it’s working:

1
2
docker --version
docker run hello-world

Basic Docker Commands

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Pull an image (download it)
docker pull eclipse-temurin:21-jdk

# Run a container
docker run --rm eclipse-temurin:21-jdk java --version

# Run with your code mounted
docker run --rm -v $(pwd):/app -w /app eclipse-temurin:21-jdk javac HelloWorld.java

# List running containers
docker ps

# List downloaded images
docker images

Key flags:

  • --rm removes the container after it exits (keeps things clean)
  • -v $(pwd):/app mounts your current directory into the container
  • -w /app sets the working directory inside the container

Helpful Resources

Last updated: