DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk12 min

How to Deploy Docker Compose Stacks with Portainer

A practical Portainer guide covering Compose stack deployment, source choices, environment variables, persistent volumes, networking, Git updates, Edge Stacks, and troubleshooting.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To deploy a Docker Compose application in Portainer, register the target Docker environment, open Stacks > Add stack, choose Web editor, Upload, Git repository, or Custom template, provide the Compose definition and variables, then select Deploy the stack. The reliable result depends on matching the deployment mode, variable method, network names, image credentials, and persistent-volume design to your application.

What Portainer is deploying

A Portainer stack is a Compose application model sent to a Docker environment. The model describes several containers, their networks, storage, ports, images, builds, secrets, configs, and environment settings as one deployable unit. The required top-level Compose element is services; every runnable component belongs beneath it.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compose creates a default network for services in the same application. Containers can therefore reach one another by service name, such as db or cache, instead of using container IP addresses that may change after a recreation. Published host ports are only needed for traffic entering from outside the Docker network. A web application can talk to PostgreSQL on its container port over the Compose network without publishing PostgreSQL to the host.

Portainer does not replace Compose semantics. It supplies a management interface for selecting the environment, source files, variables, registries, deployment mode, and operational actions. Your YAML still determines how services are built, connected, configured, and persisted.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Before you add the stack

Register the destination environment

The Docker endpoint must already be available in Portainer. A Docker Standalone environment can be connected through a Portainer Agent, direct Docker API or socket access, or an Edge Agent mode. Confirm that the endpoint appears online and that your account has permission to create stacks, pull images, and create networks and volumes.

Prepare the Compose project

  • Put every runnable component under services.
  • Give each service an image or a build context that exists in the project.
  • List only the host ports that outside clients must reach.
  • Declare named volumes for databases, queues, uploads, and other stateful paths.
  • Document required variables and provide safe defaults only where a default is genuinely acceptable.
  • Use image tags or digests deliberately so an update does not occur merely because a mutable tag changed.

Choose the deployment mode consciously

Portainer can deploy to Docker Standalone, Podman environments supported by your edition, or Docker Swarm. The variable behavior is not identical. In particular, Swarm’s docker stack deploy path does not support Compose env_file in the way Standalone deployments do. Decide which mode you are targeting before writing the variable section.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compose design that survives redeployments

Use service names for internal traffic

In the example below, the application connects to db on PostgreSQL’s container port. It does not use localhost and does not depend on a fixed container IP. The web service publishes port 8080 for outside clients; the database remains internal.

services:
  web:
    image: example/web:1.4.2
    ports:
      - '8080:8080'
    environment:
      DATABASE_HOST: db
      DATABASE_NAME: app
      DATABASE_USER: app
      DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
    depends_on:
      - db
    volumes:
      - uploads:/var/lib/example/uploads

  db:
    image: postgres:16
    environment:
      POSTGRES_DB: app
      POSTGRES_USER: app
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - database:/var/lib/postgresql/data

volumes:
  uploads:
  database:

The named volumes are part of the application definition. Compose creates a missing declared volume and reuses it on later starts. If a container is recreated because its image or configuration changed, the data remains in the volume rather than disappearing with the old container.

Do not confuse a container filesystem with durable storage

Files written only to a container’s writable layer are tied to that container instance. A redeploy can replace the instance. Mount database data, user uploads, queues, and generated assets that must survive replacement to a named volume or a deliberate bind mount. Verify the path required by the specific image; mounting the wrong directory can produce an apparently empty application even though a volume exists.

Keep external exposure narrow

A published mapping such as 8080:8080 exposes the container port on the Docker host. Omit a port mapping for services that should be reachable only by peers on the Compose network. If an administrator needs a database connection from outside, treat that as a separate firewall and authentication decision rather than publishing every service by default.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Choose how Portainer receives the Compose file

Source Best fit Operational trade-off
Web editor Small experiments or a one-off stack The configuration lives in Portainer unless you export or copy it elsewhere, so review and rollback are manual.
Upload A local, reviewed YAML file Each update requires another manual transfer from the workstation.
Git repository Team review, version history, rollback, and repeatable redeployments Portainer must access the repository, use the intended branch or reference, and store or reach the cloned project. Git submodules are not supported in the documented workflow.
Custom template Repeated internal patterns with a standard starting point Template ownership, updates, and permissions need governance so users do not deploy stale or unsafe variants.

For a personal test, the Web editor is quickest. For an application that will be updated by more than one person, a reviewed Git repository normally gives the clearest history. Portainer clones the entire Git repository during a Git deployment, so repository size and the location of the Compose file matter.

Step-by-step: deploy a stack in Portainer

  1. Open the target environment. In Portainer, select the registered Docker or Podman environment where the containers should run. Confirm it is online before opening the stack form.
  2. Open the stack workflow. Select Stacks, then Add stack. Enter a clear stack name using the naming convention your team uses; the name is how you will find logs, redeploy actions, and variables later.
  3. Select a source method. Choose Web editor to paste YAML, Upload to select a local Compose file, Git repository to pull a project, or Custom template to start from an approved pattern.
  4. Provide the Compose definition. For the Web editor, paste the complete YAML. For Upload, select the file. For Git, enter the repository URL, the branch or other reference, the path to the Compose file, and credentials when the repository is private. Include any additional files that your Portainer edition and deployment form support.
  5. Add variables. Enter variables individually in Portainer or load a .env file where the interface provides that option. The YAML reference must match the variable name exactly, for example ${POSTGRES_PASSWORD}.
  6. Choose registries when required. If an image is private, select or configure the registry credentials that Portainer should use. A valid YAML file can still fail when the target environment cannot authenticate to the image registry.
  7. Review the deployment mode and paths. Check published ports, volume destinations, repository reference, and any mode-specific variable behavior before starting. Ensure the selected endpoint has enough disk space for images and volumes.
  8. Deploy. Click Deploy the stack. Portainer creates the network and declared volumes as needed, pulls or builds images, and starts the services according to the Compose definition.
  9. Verify the result. Open the stack’s service list and inspect container status and logs. Confirm that the application answers on its intended port, can resolve its dependencies by service name, and can read and write its mounted data path.

Variables and .env files

Portainer’s variable controls

Portainer can accept variables one at a time or load values from a .env file. A Compose expression such as ${APP_PORT} is substituted from the variables available to the stack. Keep passwords, tokens, and private keys out of a public repository; use Portainer’s protected variable controls or an appropriate secrets mechanism, and restrict access to repository credentials.

Names are case-sensitive. A typo in the Portainer variable list, a different spelling in the YAML, or an unset value can result in an empty setting being passed to the container. After deployment, inspect the service configuration and logs rather than assuming the value was loaded.

Standalone and Podman: the generated stack.env option

For Standalone or Podman deployments, Portainer can use the generated stack.env with an env_file entry. This is useful when several services consume the same set of values. The file and the YAML must be arranged so the runtime can read the path Portainer creates for that stack.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Swarm: do not rely on env_file

Docker Swarm deployment uses docker stack deploy, which does not support env_file through that path. Define the required variables manually in the stack configuration or use Swarm’s supported secrets and configs mechanisms. A Compose file that works in Standalone because it reads an env file can therefore require a different variable arrangement when moved to Swarm.

Git deployments and repeatable updates

Check the repository inputs

A Git source is only repeatable when every input is explicit. Record the repository URL, branch or reference, Compose-file path, credentials method, and any required companion files. Portainer clones the entire repository, not just the single YAML file. Remove unnecessary large artifacts and make sure the selected reference contains the path you entered.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Understand the update cycle

When the repository changes, redeploy the stack using the intended reference and review the resulting diff in your normal change process. Git submodules are not supported in the documented Portainer workflow, so a project that depends on them must be reorganized or its required files made available directly.

Pin image tags or digests when reproducibility matters. If you intentionally track a moving tag, document who approves updates and how to return to the previous image. A Git rollback changes the Compose definition, but it does not automatically restore a database schema or application data to an earlier state.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What happens during a redeploy

Compose’s up --detach command starts services in the background and can recreate services whose image or configuration changed. A recreation normally keeps data mounted from named volumes, but it can still interrupt connections while the replacement starts. Portainer’s redeploy action follows the same underlying model: changed services are updated, unchanged services may remain running, and declared volumes are reused.

Use the detached CLI when reproducing a Portainer result on the host:

docker compose up --detach

The command aggregates output from the containers when run without detaching; with --detach, it returns after starting them in the background. Portainer remains the place to inspect the resulting stack, service state, and logs when the deployment was initiated there.

Plan updates for stateful services

  • Back up databases and important uploads before changing database images or schema-sensitive application versions.
  • Read the image’s upgrade notes and verify that the mounted data path has not changed.
  • Update one risky component at a time when a full-stack change would make diagnosis difficult.
  • Watch logs and health indicators after recreation, then test login, reads, writes, background jobs, and outbound integrations.

Edge Stacks and remote environments

For an Edge Stack, choose one or more Edge Groups, select the deployment type, and then choose Web editor, Upload, Repository, or Template. The target devices must be able to obtain the images and any repository content required by the stack. Treat an Edge deployment as a fleet operation: confirm group membership, network reachability, disk capacity, and the expected configuration before selecting multiple groups.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

GitOps updates and several additional Edge controls are documented as Business Edition features. If an Edge environment is unavailable, Portainer’s documented default is not to retry the failed deployment automatically. Check the edge device and deployment status, correct the underlying issue, and initiate the deployment again rather than assuming a later automatic retry will occur.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting by symptom

The stack deploys, but a service is unhealthy or exits

  • Open the service logs in Portainer and identify the first configuration or connection error, not only the final shutdown message.
  • Check that every referenced variable exists and that values are valid for the image.
  • Verify the image tag, registry credentials, build context, and mounted paths.
  • Confirm that a dependency is addressed by its Compose service name and container port.

Two services cannot resolve each other

Verify that both services are attached to the same Compose network. In application settings, use the service name, such as db, rather than a container IP or localhost. If you changed network declarations, redeploy so the containers are recreated with the intended attachments.

A changed image or setting is not visible

Redeploy the stack. Compose’s up operation detects changed configuration or images and recreates affected containers. Then inspect the running container’s image, environment, mounts, and logs to confirm that the new definition was applied. If a mutable image tag was reused, make the image update explicit according to your normal release procedure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Data appears to have vanished

Inspect the container’s mounts and compare them with the path where the application stores data. If the path was never backed by a named volume or deliberate bind mount, the files may have existed only in the replaced container. If a volume is present but empty, check whether the application image expects a different directory or whether a new volume name was introduced by changing the stack name or volume declaration.

Variables are empty

Check the Portainer variable list or loaded .env file, the exact spelling of every ${VARIABLE} reference, and the deployment mode. Standalone and Podman can use Portainer’s generated stack.env with env_file; Swarm’s docker stack deploy path cannot use that method. Define the values manually for Swarm instead.

A Git deployment fails before containers start

  • Confirm the branch or reference exists and is spelled correctly.
  • Confirm the Compose-file path is relative to the repository and exists at that reference.
  • Test the credentials and access policy for the repository.
  • Check repository size and available clone storage on the Portainer environment.
  • Remove reliance on unsupported Git submodules or include the needed files directly.

An image cannot be pulled

Check that the target environment has network access to the registry, that the image name and tag are correct, and that the selected registry credentials have permission to read the repository. Registry selection in the stack form does not repair an incorrect image reference or an expired credential.

Security and operations checklist

  • Use a dedicated Portainer account or team permissions for stack deployment rather than sharing administrator credentials.
  • Keep repository tokens, registry passwords, database passwords, and application secrets out of committed YAML whenever possible.
  • Publish only ports that must accept external traffic, and apply host firewall rules and application authentication.
  • Use named volumes and test backups; a volume preserves data across recreation but is not itself a backup.
  • Pin production images to reviewed tags or digests and record the update procedure.
  • Keep the Compose file, variable names, required paths, and recovery notes under change control.
  • After every deployment, check service state, logs, network connectivity, mounted volumes, and a representative user transaction.

A practical decision guide

Use the Web editor when speed matters more than repository history

It is appropriate for a short-lived test, a small laboratory stack, or an emergency configuration change that you will immediately copy into your normal source control. Its weakness is operational memory: the authoritative file can remain inside Portainer and be harder for another operator to review.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Upload when the file has already been reviewed locally

Upload is a straightforward boundary between a workstation and Portainer. It works well when a change process produces a specific YAML artifact, but every later modification requires another transfer and a deliberate record of which file was used.

Use Git for a team-owned application

A repository gives you review, history, a named reference, and a practical rollback point. Make the Compose path, variable contract, image policy, and update steps part of the project documentation. Remember that Portainer clones the whole repository and does not support Git submodules in the documented flow.

Use a Custom template for governed repetition

Templates are useful when many teams need the same approved architecture, such as a web service plus database and persistent storage. Assign an owner, version templates, and review changes so convenience does not turn into untracked infrastructure drift.

Final verification before calling the deployment complete

  1. Confirm the correct Portainer environment and deployment mode.
  2. Confirm the stack source, branch or uploaded file, and Compose path.
  3. Confirm every required variable is present and appropriate for that mode.
  4. Confirm private images can be pulled with the selected registry credentials.
  5. Confirm internal connections use service DNS names and only necessary host ports are published.
  6. Confirm databases, uploads, and other stateful paths use the intended named volumes or bind mounts.
  7. Open service logs, perform a real application check, and record the deployed image references.

Once those checks pass, Portainer gives you a repeatable place to inspect, redeploy, and troubleshoot the Compose application without changing the underlying Compose model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.