Skip to main content

Overview

Docker deployment provides a containerized, production-like environment for running the simulator. This method is recommended for evaluation, testing, and consistent deployment across different systems.

Prerequisites

  • Docker Desktop installed on your system
  • Basic familiarity with Docker commands

Dockerfile

The project includes a lightweight Dockerfile that uses Nginx Alpine to serve the static application:
FROM nginx:alpine
COPY . /usr/share/nginx/html
EXPOSE 80
This Dockerfile:
  • Uses the lightweight nginx:alpine base image
  • Copies all project files to Nginx’s web root
  • Exposes port 80 for HTTP traffic

Deployment Steps

1

Clone the repository

First, clone the project repository:
git clone https://github.com/SebastianMoreno0911/AlgoritmosPlanificacion.git
cd AlgoritmosPlanificacion/Planificacion
2

Build the Docker image

Build the Docker image with a descriptive tag:
docker build -t algoritmos-planificacion .
This process typically takes less than a minute as the image is very lightweight.
3

Run the container

Start the container and map port 8080 to the container’s port 80:
docker run -p 8080:80 algoritmos-planificacion
The -p 8080:80 flag maps your local port 8080 to the container’s port 80. You can change 8080 to any available port on your system.
4

Access the application

Open your web browser and navigate to:
http://localhost:8080
The simulator should now be running in your Docker container!

Docker Commands Reference

docker build -t algoritmos-planificacion .

Advanced Options

Running in Detached Mode

To run the container in the background (detached mode):
docker run -d -p 8080:80 --name cpu-scheduler algoritmos-planificacion
The -d flag runs the container in detached mode, and --name gives it a friendly name.

Using Different Ports

If port 8080 is already in use, you can map to a different port:
# Use port 3000 instead
docker run -p 3000:80 algoritmos-planificacion

# Access at http://localhost:3000

Viewing Container Logs

To view Nginx access logs:
docker logs -f cpu-scheduler
The -f flag follows the log output in real-time.

Benefits of Docker Deployment

Consistency

Runs identically on any system with Docker

Isolation

Contained environment doesn’t affect your system

Production-Ready

Uses Nginx, a production-grade web server

Easy Cleanup

Remove everything with a single command

Troubleshooting

If you see an error about port 8080 being in use, either:
  • Stop the application using that port
  • Use a different port: docker run -p 3000:80 algoritmos-planificacion
Ensure Docker Desktop is running. On macOS/Windows, check the system tray for the Docker icon.
On Linux, you may need to run Docker commands with sudo, or add your user to the docker group:
sudo usermod -aG docker $USER
Then log out and back in.
Ensure you’re in the correct directory containing the Dockerfile:
cd AlgoritmosPlanificacion
ls -la Dockerfile
Remember to stop and remove containers when you’re done to free up system resources:
docker stop cpu-scheduler
docker rm cpu-scheduler

Build docs developers (and LLMs) love