4

I have this simple Docker Compose manifest

version: '2'
services:
  dummy:
    image: hello-world

When I run it locally, I get the expected behavior / output.

PS> docker-compose up -d; $?; $LASTEXITCODE
Creating network "temp_default" with the default driver
Creating temp_dummy_1 ...
Creating temp_dummy_1 ... done

True
0

When I run it remotely, I get an error creating the network.

[example.com]: PS> docker-compose up -d; $?; $LASTEXITCODE
docker-compose : Creating network "temp_default" with the default driver
At line:1 char:1
+ docker-compose up -d
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Creating networ... default driver:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Creating temp_dummy_1 ...
Creating temp_dummy_1 ... done

False
0

However, the network is created just fine.

[example.com]: PS> docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
b170367ba141        temp_default        bridge              local

What's happening and how do I fix this? I need the command to succeed because I need to distinguish a good up from a bad one. As long as PowerShell thinks this is a failure, I can't make any progress. Can I depend on the docker-compose exit code?

Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188

0 Answers0