Deploy your first Docker service to test your installation.
Deploying a simple service validates your Docker installation and workflow.
Deploying a simple service like whoami validates your Docker installation and helps you understand the basic workflow of running containers.
Create a `docker-compose.yml` file: ```yaml services:
whoami:
image: traefik/whoami:latest
container_name: whoami
restart: unless-stopped
ports:
- "8080:80"
```
```bash docker compose up -d ```
This pulls the image and starts the container in the background.
```bash curl http://localhost:8080 ```
You should see information about the request, including the container hostname.
```bash docker compose logs whoami ```
This shows the container's log output.
```bash docker compose down ```
This stops and removes the container.
```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 ```