Getting Started

This guide will help you install and run Swiftdock on your Mac.

Prerequisites

Installation

Clone the Repository

git clone https://github.com/meetsaspara/swiftdock.git
cd swiftdock

Build the Project

swift build

This will compile both the daemon (swiftdockd) and CLI (swiftdock).

Running Swiftdock

Two-Terminal Setup: Swiftdock consists of a daemon (server) and a CLI (client). You'll need two terminal windows.

Step 1: Start the Daemon

In your first terminal window:

cd swiftdock
swift run swiftdockd

You should see:

info HummingBird: [HummingbirdCore] Server started and listening on 127.0.0.1:8080

Keep this terminal running! The daemon must stay active to handle CLI commands.

Step 2: Use the CLI

Open a new terminal tab/window (Cmd+T or Cmd+N), navigate to the project:

cd swiftdock

Your First Container

Pull an Image

swift run swiftdock pull alpine:latest

This downloads the Alpine Linux image from Docker Hub.

Run a Container

swift run swiftdock run alpine:latest -- echo "Hello from Swiftdock!"

Output:

Creating container for alpine:latest...
Created 6B53E52E-B2EC-435D-B957-B5202C1E5677
Starting...
Started with PID 85965
(Polling for exit...)
Container exited.
Hello from Swiftdock!

List Containers

swift run swiftdock ps

This shows all containers (running and exited).

View Logs

swift run swiftdock logs <CONTAINER_ID>

Replace <CONTAINER_ID> with the full ID from the run command output.

Troubleshooting

Address Already in Use

If you see bind: Address already in use, another instance of the daemon is running:

pkill swiftdockd
swift run swiftdockd

Could Not Connect to Daemon

Make sure the daemon is running in a separate terminal. Check that you see the "Server started" message.

Package.swift Not Found

Ensure you're in the swiftdock directory (the one containing Package.swift):

cd swiftdock
ls Package.swift  # Should show the file

Next Steps