Docker compose failing in windows 10 - docker-compose

I am on docker for windows version 2.3.0.5 and my docker compose is failing with this stranger error :
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose\cli\main.py", line 78, in main
TypeError: can only concatenate str (not "dict") to str
[25608] Failed to execute script docker-compose

For me, it was because docker-compose wasn't able to find a referenced Dockerfile. This happened after renaming one of the projects (thus changing its folder's name).

Thanks for your help, it turned out to be a windows issue with docker which is a nightmare.
So I have restarted Docker and it works.

In my case this turned out to be a lack of resources allocated to Docker so I had to go to docker dashboard and increase memory and cpu allocated.

If you use dockerfile: . in docker-compose file, it would probably give the error mentioned above.
To avoid this error explicitly specify the dockerfile name as dockerfile: Dockerfile

I had this problem and it turns out that I still had venv enables. Once I got out (deactivate) it worked perfectly.

Related

Docker Compose - invalid variable

I have docker compose yml file in my project file.
When try to run the below commend i get the below error.
docker-compose up
I get the below error message
invalid variable name "docker-compose.yml"
I have installed and uninstalled docker multiple times.
my Docker version - Docker version 20.10.8, build 3967b7d
my docker-compose version - Docker Compose version v2.0.0-rc.3
Check that your environment variables or .env file does not contain multiline variables (e.g. SSH keys). After flattening them, error should disappear. Source: https://github.com/Azure/aci-deploy/issues/29

How can I use docker-compose in a bitbucket pipeline to deploy to a remote host?

Currently I have a git project in bitbucket that has a web application which is dockerised. I have subsequently created a bitbucket-pipelines.yml file which outlines my entire deployment process.
All of my CI works great, I can build, test and push my production image to the dockerhub registry.
Now to the final stage, deploy. This is where things get messy.
Here's my deploy section of my pipelines config:
image: atlassian/default-image:2
pipelines:
branches:
master:
- step:
trigger: manual
deployment: production
name: Deploy
services:
- docker
script:
- export IMAGE_VERSION=$BITBUCKET_BUILD_NUMBER
- export DOCKER_HOST=ssh://root#$IP_ADDRESS
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- ./cd.sh pull
- ./cd.sh deploy
- ./cd.sh migrate
- ./cd.sh clean
And here is the error from the build:
+ ./cd.sh pull
[240] Failed to execute script docker-compose
Traceback (most recent call last):
File "site-packages/docker/api/client.py", line 151, in __init__
NameError: name 'SSHAdapter' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 124, in perform_command
File "compose/cli/command.py", line 42, in project_from_options
File "compose/cli/command.py", line 123, in get_project
File "compose/cli/command.py", line 94, in get_client
File "compose/cli/docker_client.py", line 127, in docker_client
File "site-packages/docker/api/client.py", line 156, in __init__
docker.errors.DockerException: Install paramiko package to enable ssh:// support
I currently have my SSH keys correctly setup so I know that's not the problem. I tested this from my local machine connecting to my staging environment and it worked fine.
I'm guessing this is a limitation in using the default atlassian image? It probably is using an older version of docker or something?
My remote machine basically has docker running on it with only the containers it needs running my services. It doesn't have the git project mounted in or anything.
Does anyone have any idea how to overcome this issue using bitbucket pipelines?
If not, any suggestions on a better deployment strategy?
I'm using docker-compose v3.3.
Thanks.
Sorry for the 10 month late replay, I take you came right however, I would recommend putting the ssh onto the server itself and then using something like this to execute the ssh from bitbucket itself
- step:
name: 'Deploying to QA'
deployment: qa
script:
- pipe: atlassian/ssh-run:0.2.2
variables:
SSH_USER: '$SSH_USER'
SERVER: '$SSH_SERVER'
COMMAND: "sh ./deploy.sh"
Why don't you install Kubernetes instead? You could get away with installing something like Rancher which is opensource and has a create GUI interface.

Unable to debug java app through stack driver in google kubernetes cluster

I am trying to debug a java app on GKE cluster through stack driver.
I have created a GKE cluster with Allow full access to all Cloud APIs
I am following documentation: https://cloud.google.com/debugger/docs/setup/java
Here is my DockerFile:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} alnt-watchlist-microservice.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/alnt-watchlist-microservice.jar"]
In documentation, it was written to add following lines in DockeFile:
RUN mkdir /opt/cdbg && \
wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \
tar xvz -C /opt/cdbg
RUN java -agentpath:/opt/cdbg/cdbg_java_agent.so
-Dcom.google.cdbg.module=tpm-watchlist
-Dcom.google.cdbg.version=v1
-jar /alnt-watchlist-microservice.jar
When I build DockerFile, It fails saying tar: invalid magic , tar: short read.
In stackdriver debug console, It always show 'No deployed application found'. Which application it will show? I have already 2 services deployed on my kubernetes cluster.
I have already executed
gcloud debug source gen-repo-info-file --output-directory="WEB-INF/classes/
in my project's directory.
It generated source-context.json. After its creation, I tried building docker image and its failing.
The debugger will be ready for use when you deploy your containerized app. You are getting No deployed application found error because your debugger agent is failing to download or unzip in dockerfile.
Please check this discussion to resolve the tar: invalid magic , tar: short read. error.
Unfortunately it looks like Alpine isn't regularly tested with Debugger. There's a sample setup here that might help you: https://github.com/GoogleCloudPlatform/cloud-debug-java#alpine-linux
I resolved the issue.
Firstly, you will have to use java image "gcr.io/google-appengine/openjdk" instead of Alpine one.
Secondly,
I was putting entry points without comma separated (Basically in wrong format)
ENTRYPOINT ["java","-agentpath:/opt/cdbg/cdbg_java_agent.so", "-Djava.security.egd=file:/dev/./urandom" ,"-Dcom.google.cdbg.module=watchlist"]

Space in path for docker-compose.yml

I am getting;
Error: Command failed: docker stack deploy --compose-file /Users/myUser/OneDrive - My Company/Code/myProject/node_modules/tools/lib/wdio/docker-compose.yml wdio
"docker stack deploy" requires exactly 1 argument.
I suspect the space in the path because the code is hosted on an MS OneDrive. I cannot change the name of the One Drive. Is there a way to get docker to handle the spaces correctly on a Mac/Unix?
You can try this:
docker stack deploy --compose-file /Users/myUser/OneDrive\ -\ My\ Company/Code/myProject/node_modules/tools/lib/wdio/docker-compose.yml wdio

Docker compose - image not found

I'm following http://bradgessler.com/articles/docker-bundler. The first time around, it made "bundler fast again". I started getting issues with some missing linked files in the gems, so I blew away the docker images, and did a docker-compose build. After it built, I could no longer do docker-compose run web bundle -- I get this:
Creating network "myapp_default" with the default driver
Pulling bundle (myapp_web:latest)...
Pulling repository docker.io/library/myapp_web
ERROR: Error: image library/myapp_web:latest not found
How do I resolve this?
Following the same article, here are the steps that worked for me:
Run docker-compose build web
Find the name of your web image: run docker images. Mine was 'appcontainer_web'
Open docker-compose.yml and replace 'image: myapp_web' with 'image: [your_image_name]'
After the above change I still encountered an error: No closing quotation. The fix was to remove the quote from "I'm" in that same docker-compose.yml file "command: echo I'm a little..."