Run Docker Remotely with Portainer Instead of Docker Desktop


Managing Docker remotely, especially on a Linux server, is a powerful alternative to using Docker Desktop on your local machine. In this guide, we’ll walk through how to:
Host and manage Docker containers remotely.
Use Portainer as a graphical interface to control Docker.
Replace Docker Desktop with a more flexible and lightweight remote workflow.
Whether you're a DevOps engineer, a cloud enthusiast, or simply exploring alternatives to Docker Desktop, this setup will enhance your productivity.
🧱 Why Portainer Instead of Docker Desktop?
Docker Desktop is great, but it has limitations:
Requires a GUI and lots of system resources.
Licensing costs for teams.
Tied to your local machine.
Portainer is:
Lightweight
Web-based
Platform-agnostic
Perfect for headless servers and remote access.
🗂️ Step-by-Step Guide
1. Connect to Your Server
SSH into your remote server:
ssh your-user@your-server-ip
Switch to root if necessary:
sudo -i
2. Create a Directory for Docker Configs
We’ll organize Portainer and any other services under /opt/docker
:
mkdir -p /opt/docker && cd /opt/docker
3. Prepare portainer.yml
File
Create a Docker Compose file for Portainer:
nano portainer.yml
Paste the following content:
version: '3.8'
services:
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
restart: unless-stopped
ports:
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
volumes:
portainer_data:
Save and exit (Ctrl + O
, Enter
, Ctrl + X
).
4. Start Portainer
Now launch Portainer with:
docker compose -f portainer.yml up -d
You should see:
✔ Container portainer Started
To follow logs:
docker compose -f portainer.yml logs -f
5. Access Portainer in a Browser
Open your browser and go to:
http://<your-server-ip>:9000
You’ll be prompted to set up an admin password and connect to your local Docker environment (it’ll detect the Docker socket you mapped).
🔍 Confirm It’s Working
To check if Portainer is running:
docker ps
Expected output:
CONTAINER ID IMAGE PORTS NAMES
xxxxxxx portainer/portainer-ce 0.0.0.0:9000->9000/tcp portainer
You can also view logs anytime:
docker logs portainer
⚙️ Run Docker Remotely Like It’s Local
You can run any Docker CLI commands remotely without touching your lab machine directly.
Option 1: Set a Permanent Remote Docker Context
Edit your .zshrc
file on your Mac:
echo 'export DOCKER_HOST=ssh://username@remote_ip' >> ~/.zshrc source ~/.zshrc
Now, you can run any Docker CLI command like:
docker ps
docker compose up -d
docker logs <container>
…and it’ll execute on the remote machine automatically. No ssh
, no fuss.
✅ Conclusion
You now have a clean and efficient way to manage Docker remotely without relying on Docker Desktop. Using Portainer, you gain:
A lightweight web UI
Easy container and image management
Portability across systems
Remote team-friendly access
This approach is ideal for remote development, headless servers, or teams building CI/CD and DevOps pipelines.
Subscribe to my newsletter
Read articles from Cyril Sebastian directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Cyril Sebastian
Cyril Sebastian
I’m Cyril Sebastian, a DevOps and Cloud Infrastructure architect with 10+ years of experience building, scaling, and securing cloud-native and hybrid systems. I specialize in automation, cost optimization, observability, and platform engineering across AWS, GCP, and Oracle Cloud. My passion lies in solving complex infrastructure challenges—from cloud migrations to Infrastructure as Code (IaC), and from deployment automation to scalable monitoring strategies. I blog here about: Cloud strategy and migration playbooks Real-world DevOps and automation with Terraform, Jenkins, and Ansible DevSecOps practices and security-first thinking in production Monitoring, cost optimization, and incident response at scale If you're building in the cloud, optimizing infra, or exploring DevOps culture—let’s connect and share ideas! 🔗 linkedin.com/in/sebastiancyril