Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween 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×
VGSOURCES
Get listed

Container deploymentPATCH 2026.10.15

How to Deploy Docker Compose Stacks with Portainer

By VGSources Team 12 min read

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 a source for the Compose file, provide its variables, and select Deploy the stack. Portainer supports a Web editor, local file upload, Git repository, and custom template. The correct source depends on whether you need a quick experiment, a reviewed file, or repeatable team deployments.

The important deployment decisions are made before the final click: use a valid Compose model with a top-level services element, expose only ports that must receive traffic from outside Docker, and attach named volumes to databases and other stateful services. Treat variables, image versions, Git references, and storage paths as part of the stack’s operating design rather than as one-time form fields.

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.

What Portainer is deploying

A Portainer stack is a group of containers described by a Compose file. The Compose Specification is the current recommended format. Its required top-level model element is services; each service normally declares an image or a build context and may also define ports, environment values, networks, volumes, secrets, and configs.

When Portainer deploys the file, the selected environment creates or updates those services. Compose also creates a default network for the project unless you define another arrangement. Containers on that network find one another through service-name DNS, so an application should connect to a database at a name such as db, not at a container IP address that can change after recreation.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses | Anti UV Ray, For Computers & Gaming, Square Frame, Eyewear for Men and Women
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Portainer is an interface and deployment controller; it does not turn an invalid YAML document into a valid application. Validate indentation, required keys, image names, credentials, storage paths, and the target environment before deploying.

Prepare the target environment

Register and select the environment

Confirm that the Docker environment appears in Portainer before opening the stack form. A Docker Standalone environment can be connected through an Agent, direct Docker API access, socket access, or an Edge Agent mode. Select the environment where the containers and their data should actually run; a stack created on one endpoint is not automatically present on another.

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

Decide whether the workload is standalone, Podman, or Swarm

The deployment target affects variable handling and supported Compose behavior. Docker Standalone and Podman deployments can use Portainer’s generated stack.env with an env_file. A Swarm deployment made through docker stack deploy does not support env_file in this workflow, so define the required variables manually in Portainer’s stack settings instead.

Check the Compose model

Every runnable component belongs under services. Confirm that each service has an appropriate image or build context and that references between services use names that exist in the file. Networks, volumes, secrets, and configs should be declared deliberately rather than relying on an accidental container-level setting.

Plan storage before starting a database

Databases, queues, uploaded media, and similar state must be mounted to a named volume or an intentional bind mount. A named volume declared by Compose is created when missing and reused on later starts. Without a persistent mount, replacing a container can leave the application with an empty data directory even though the stack itself deploys successfully.

Choose how Portainer receives the Compose file

Source Best use Operational trade-off
Web editor Small experiments or a one-off stack The configuration lives in Portainer unless you export or copy it elsewhere.
Upload A local, reviewed YAML file You must transfer a new file manually whenever the stack changes.
Git repository Team review, rollback, and repeatable redeployment Repository access, the selected reference, clone storage, and credentials must remain usable.
Custom template Repeated internal patterns Template ownership, updates, and permissions need governance.

Use the Web editor for a short-lived or small stack

The Web editor is the fastest route when the YAML is short and the stack does not need a separate change-history system. Paste the complete Compose document into the editor, including all required services and declarations. For a production workload, keep a copy in a reviewed repository even if the initial deployment used the editor.

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

Upload a known local file

Choose Upload when the Compose file has already been checked on your workstation or in a release process. Select the file in the stack form and confirm that any companion files required by the Compose document are available through the selected Portainer edition and deployment mode.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Deploy from Git

Git deployment is useful when the file is reviewed, versioned, and expected to be redeployed. Enter the repository URL, the branch or other reference, and the path to the Compose file. Supply credentials when the repository is private. Portainer clones the entire repository for a Git deployment, and the documented workflow does not currently support Git submodules.

Keep the reference and Compose path explicit. A valid repository with the wrong branch or a correct branch with the wrong path produces a deployment failure that can look like a Docker problem even though the file was never loaded.

Use a custom template for governed repetition

Templates are appropriate when an organization repeatedly deploys the same pattern. Define who can change the template, how revisions are announced, and which variables an operator must provide. A template should reduce typing without hiding the storage, network, image, and secret decisions that affect the running application.

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

Deploy a stack in Portainer

  1. Open the target environment. In Portainer, select the registered Docker, Podman, or Swarm endpoint where the stack belongs.
  2. Open the stack form. Go to Stacks, select Add stack, and enter a clear stack name. Use a name that identifies the application and environment without relying on a temporary ticket number.
  3. Select a source. Choose Web editor, Upload, Git repository, or Custom template. For Git, fill in the repository URL, reference or branch, Compose-file path, and credentials if required.
  4. Provide the Compose document. Paste or select the YAML, or let Portainer load it from the repository. Make sure the file has a top-level services key and that all referenced volumes and networks are defined as intended.
  5. Set variables. Add variables individually in Portainer or load a .env file where that deployment mode supports it. Compose expressions such as ${POSTGRES_PASSWORD} are replaced from the variables supplied to the stack.
  6. Choose registries when necessary. If an image is private, select or configure the registry credentials that Portainer should use to pull it. A successful YAML parse does not prove that the target can authenticate to every image registry.
  7. Deploy and inspect. Click Deploy the stack. After Portainer reports the deployment, open the service list and logs. Confirm that containers are running, health checks (if defined) pass, expected ports are listening, and the application can reach its dependencies.

Example Compose file

This small example demonstrates a named database volume, a published web port, an internal service network, and a variable supplied by Portainer. The web container serves its default page; the database illustrates how a stateful service is mounted and addressed on the Compose network.

services:
  web:
    image: nginx:1.27-alpine
    ports:
      - "8080:80"
    networks:
      - app_net

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

networks:
  app_net:

volumes:
  db_data:

Add POSTGRES_PASSWORD as a Portainer variable (or load it through the supported environment-file workflow) before deploying. A client running in another service on app_net would use db as the host and the container’s database port, not the host’s published web port.

Load variables and environment files correctly

Enter variables in the Portainer form

For a small stack, add each variable in the stack’s environment-variable section. The variable name must exactly match the expression in the YAML, including capitalization and underscores. For example, ${POSTGRES_PASSWORD} requires a variable named POSTGRES_PASSWORD; a similarly named value is not substituted.

Load a .env file

Portainer can accept variables individually or from a .env file. Keep secrets out of a public repository and restrict access to files that contain passwords, tokens, or private keys. If a Git repository contains a non-secret defaults file, do not assume that it is safe to commit production credentials into the same repository.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men | Office Gifts for Women, iPhone Stand, Gadgets for Men, Office Decor, Gaming Desk Accessories for Samsung Fold 8, Switch, iPad
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Understand stack.env and env_file

On Docker Standalone and Podman, Portainer can generate or use stack.env with an env_file entry. This supplies variables to containers according to Compose rules. It is distinct from Portainer’s interpolation variables: the former controls a container’s environment, while the latter supplies values used when expressions such as ${VARIABLE} are resolved in the Compose document.

Do not carry that pattern unchanged into Swarm. The Swarm path uses docker stack deploy, where env_file is not supported through this workflow. Define the required variables manually in Portainer for the Swarm stack and verify the rendered service configuration after deployment.

Diagnose an empty variable

  • Check that the variable exists in the stack’s Portainer settings or loaded file.
  • Compare its spelling and capitalization with every ${...} expression in the YAML.
  • Confirm that you are deploying to the expected environment and mode.
  • For Swarm, remove reliance on env_file and define the values through the supported stack-variable controls.

Configure networking and published ports

Use service DNS for internal traffic

Compose gives services a default network, and services on a shared network resolve one another by service name. If the database service is named db, application configuration should use db as the hostname. Container IP addresses are implementation details and can change whenever a service is recreated.

Publish only external entry points

A port mapping such as 8080:80 publishes container port 80 on host port 8080. Use mappings for traffic that must enter from outside the Docker network, such as a web server or an explicitly exposed API. Service-to-service traffic should use the container port over the shared network instead of publishing every dependency to the host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Traffic Recommended configuration Reason
Browser to web service Publish the web container’s listening port The request originates outside the Compose network.
Application to database Use the database service name and container port The services already share an internal network.
Application to queue Use the queue service name and container port No host exposure is required for internal communication.

If two services cannot resolve one another, verify that both are attached to the same Compose network and that the hostname matches the service key. Recreating a container does not justify changing the hostname to a newly observed IP address.

Preserve data with named volumes

Declare a named volume for every directory whose contents must survive container replacement. Compose creates a missing declared volume and reuses it on later starts, so a database can be recreated without starting with an empty data directory. The volume name and the container path both matter: mounting the volume at the wrong path leaves the application’s real data directory unprotected.

Use deliberate bind mounts when the data must live at a specific host path, be managed by an existing backup system, or be edited directly by an administrator. Bind mounts add host-path permissions and portability concerns, so document the path and ownership requirements alongside the Compose file.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
  • Identify database data directories, queue state, upload directories, and generated assets.
  • Declare a named volume or intentional bind mount for each stateful path.
  • Check that the target host has enough storage and that the container user can write to the mount.
  • Back up the stored data independently; a volume preserves data across recreation but is not itself a backup.

Update a deployed stack safely

Redeploy after changing the source

If an image reference or configuration changes and the running service still shows the old behavior, redeploy the stack from its updated source. Compose’s up operation detects changed configuration and recreates affected containers while preserving mounted volumes. Portainer’s redeploy action performs the corresponding stack update for the selected environment.

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.

Pin releases and document the update path

Use a specific image tag or digest when repeatability matters. Floating tags can change what a future deployment pulls, making a rollback harder to reproduce. Record which reference was intended, which variables are required, and whether a schema migration or data backup is needed before updating.

Separate configuration changes from data removal

Recreating a container is different from deleting its named volume. Treat any operation that removes volumes as a data-destructive change and require a verified backup before using it. If data appears missing after an update, first inspect the volume and mount path rather than assuming the application has lost the records permanently.

Deploying from Git without surprises

For a repository-based stack, verify all of the following before selecting Deploy the stack:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The repository URL is reachable from the Portainer environment and credentials have permission to clone it.
  • The selected branch, tag, or other reference contains the intended Compose revision.
  • The Compose-file path is relative to the repository and matches its actual capitalization.
  • Any additional files expected by the Compose document are present in the cloned repository or supported by the selected Portainer edition.
  • The repository has enough space for Portainer to clone the entire repository.
  • No required Git submodule is being relied on; submodules are not supported in the documented Git deployment workflow.

Keep secrets in Portainer’s variable controls or an appropriate secrets mechanism rather than committing them to the repository. Protect deploy keys and repository credentials with the same care as application passwords.

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

Edge Stack deployment

Edge deployments use a different selection flow because the target may be a group of remote environments. Open the Edge Stack workflow, choose one or more Edge Groups, select the deployment type, and then choose Web editor, Upload, Repository, or Template as the source. Review which environments are in the group before deploying; a group selection can place the stack on multiple remote endpoints.

GitOps updates and several additional Edge controls are documented as Business Edition features. If your workflow depends on those controls, confirm that the edition and version in use provide them before designing an automated update process.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

If an Edge environment is unavailable, Portainer’s documented default behavior is not to retry the failed deployment automatically. Treat an unavailable target as an operational incident: check connectivity and agent status, then rerun the deployment after the endpoint is reachable.

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

Troubleshoot the most common failures

The stack form rejects the YAML

Check indentation, list markers, quotation, and the presence of the top-level services key. Then inspect every service for an image or build context and every referenced variable, network, and volume. A parser error must be fixed in the Compose document before container logs can provide useful information.

Images cannot be pulled

Confirm the image name and tag, select the required private registry credentials, and verify that the target environment can reach the registry. If the file came from Git, make sure Portainer cloned the intended reference rather than a branch containing an obsolete image.

Containers run but cannot connect to each other

Verify that the services share a network and that the client uses the service key as its hostname. Use the container port for internal traffic. Do not substitute a host-published port or a previously observed container IP unless the architecture explicitly requires host routing.

Variables are blank or contain unexpected defaults

Compare the exact variable names in Portainer with the ${VARIABLE} expressions in the YAML. Check whether the deployment is Docker Standalone, Podman, or Swarm, because the stack.env/env_file behavior differs. Inspect the rendered service environment and logs without printing secrets into shared output.

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

Data disappeared after recreation

Inspect the service’s mounts and confirm that the database or upload path is backed by the intended named volume or bind mount. A container filesystem without a persistent mount is disposable. Also verify that the updated Compose file did not change the volume name or mount destination.

A configuration or image change is not visible

Redeploy the stack so Compose can compare the desired configuration with the running services. Check service logs and the image identifier afterward. If the source is Git, verify the reference and file path; if the source is an upload or Web editor, verify that the edited document was actually submitted.

Git deployment fails before services start

Recheck repository credentials, branch or tag, Compose path, repository size, and unsupported submodules. These failures occur during source retrieval, so Docker service logs may remain empty until the repository problem is corrected.

An Edge deployment remains incomplete

Check the affected Edge environment’s availability and agent connectivity. Because the documented default is no automatic retry for an unavailable environment, rerun the deployment after recovery and confirm the stack status on that endpoint.

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

A repeatable operating pattern

  1. Keep the Compose file and a short deployment note under version control.
  2. Pin image tags or digests and record the intended update procedure.
  3. Store secrets in Portainer variables or a suitable secrets system, not in a public repository.
  4. Declare networks and named volumes explicitly so service discovery and persistence do not depend on defaults you forgot to document.
  5. Use Git for team review and rollback; use the Web editor or Upload for deliberately small, manually managed stacks.
  6. After every deployment, inspect service status, logs, mounts, published ports, and dependency connectivity.
  7. Back up stateful data before upgrades that may change schemas or before any operation that could remove volumes.

With those controls in place, Portainer becomes a clear front end for the same Compose lifecycle: define services, supply variables, create or update containers, and keep state in explicitly managed storage.

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.

Container deploymentDevOpsDockerDocker ComposePortainerself-hosting

Leave a reply

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

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.

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.