Site Tools


hosting:docker:first_service

First Service Deployment

Deploy your first Docker service to test your installation.

Deploying a simple service validates your Docker installation and workflow.

Overview

Deploying a simple service like whoami validates your Docker installation and helps you understand the basic workflow of running containers.

Create docker-compose.yml

Create a `docker-compose.yml` file: ```yaml services:

whoami:
  image: traefik/whoami:latest
  container_name: whoami
  restart: unless-stopped
  ports:
    - "8080:80"

```

Start the Service

```bash docker compose up -d ```

This pulls the image and starts the container in the background.

Test the Service

```bash curl http://localhost:8080 ```

You should see information about the request, including the container hostname.

View Logs

```bash docker compose logs whoami ```

This shows the container's log output.

Stop the Service

```bash docker compose down ```

This stops and removes the container.

Common Commands

```bash docker compose ps # List containers docker compose logs -f # Follow logs in real-time docker compose restart # Restart services docker compose stop # Stop services docker compose start # Start stopped services ```

See Also

Last updated: 2026-06-19



hosting/docker/first_service.txt · Last modified: by 127.0.0.1