Command docker-compose up gets stuck - docker

I'm currently working in a custom project involving Docker and Jboss. The first 2/3 times that I run the command docker-compose up, the log gets stuck in different part of the build. After those 2/3 attempts, the command works correctly. I'm working on a MacBook Pro 2021 with macOS Ventura 13.0.
The docker-compose file is the following:
version: '2'
services:
webapp:
environment:
- SCRIPT_DEBUG=false
- DEBUG=${WEBAPP}
image:
"${REGISTRY}/ispdev/jboss:743GA-jdk1.8-V2"
ports:
- "${WEBAPP_PORT}:8080"
- "${WEBAPP_DEBUG_PORT}:8787"
volumes:
- "${WS_ROOT_DIR}/${APPL_ROOT}/${WEBAPP_EAR_DIR}/${WEBAPP_FINAL_ARTIFACT}:/opt/eap/standalone/deployments/${WEBAPP_FINAL_ARTIFACT}"
- "${WS_ROOT_DIR}/${COMPOSE_ROOT}/resources/jboss.yml:/usr/local/y2j/jboss.yml"
I've just tried to run several times docker-compose up

What version do you have of docker? docker -v
You may have to reinstall docker. Here is a link
https://docs.docker.com/desktop/install/mac-install/

Related

Up docker container with redis 2.8 on macOS M1

Is it possible run docker container with redis:2.8 on macOS with M1?
docker log
Setup:
macOS M1
docker-compose.yml with redis 2.8
version: '2'
services:
redis:
image: redis:2.8
ports:
- "6379:6379"
Install docker through official documentation https://docs.docker.com/desktop/install/mac-install/#mac-with-apple-silicon
Run Docker application
Go into Redis2.8
Run container through button on top right corner
I got this error
In another way through
docker-compose up redis
I got this error
If you google the error you are getting runtime ...
failed to create new OS thread (have 2 already; errno=22)
you will see a hit on another StackOverflow question Failed to create new OS thread (have 2 already; errno=22). That looks to provide the answer - the platform of your M1 Mmac is not compatible with that specific image you are using so you need to find an image that will work on your M1 Mac.

Gitlab CI runner fails at docker-compose build with profiles

My idea is to have a single docker-compose file that I can configure with --profile db_as_container flag depending on whether I want to have cloud database (MongoDB atlas) or local database-as-container.
Here's my docker-compose.yml:
version: '3'
services:
app:
image: '${APP_NAME}:${TAG:-latest}'
build: .
ports:
- '${PORT}:${PORT}'
mongo_db:
image: mongo
container_name: mongo_db_container
ports:
- "27017:27017"
profiles:
- db_as_container
My docker compose up shell script (dc-up.sh) deduces whether my DB_CONNECTION_STRING is cloud type or local container type and calls appropriate up command.
TAG=${TAG} docker-compose --profile db_as_container up -d --build
vs.
TAG=${TAG} docker-compose up -d --build
And this works locally and does not complain about using profiles.
Problem is when my Gitlab CI runner runs my build script (build-and-push.sh):
TAG=${TAG} docker-compose build
It produces this error:
The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.mongo_db: 'profiles'
What am I doing wrong here?
Actually the issue was not the version of the compose file specification, but rather docker-compose itself as i've found out here
Support for service profiles was added in docker-compose version 1.28
Updating from 1.262 to 1.28.6 solved my issue.
Only Docker Compose v3 has profiles option. I'm guessing your CI compose version is a lower one.
You will need to upgrade it to version 3.

exec: "com.docker.cli": executable file not found in $PATH

I am getting this error when docker-compose up on one of the containers only.
exec: "com.docker.cli": executable file not found in $PATH
The terminal process "/bin/zsh '-c', 'docker logs -f f6557b5dd19d9b2bc5a63a840464bc2b879d375fe72bc037d82a5358d4913119'" failed to launch (exit code: 1).
I uninstalled and reinstalled docker desktop#2.3.0.5 on Mac
docker-compose build from scratch
other containers are running
I get the above error.
It used to be running. I am not sure why this is happening. I know that I upgraded docker from I think 2.3
also I think I received an update on my mac
Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8
COPY requirements.txt /app/
RUN pip install -r requirements.txt
COPY ./app /app/app
#COPY config.py /app/app/
docker-compose.yml
version: "3"
services:
postgresql:
container_name: postgresql
image: postgres:12
ports:
- "5433:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- ./postgres-data:/var/lib/postgresql/data
fastapi:
build:
context: ./fastapi/
dockerfile: Dockerfile
volumes:
- ./fastapi/app/imgs:/app/app/imgs
ports:
- "1001:80"
depends_on:
- postgresql
env_file:
- .env
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4
environment:
- PGADMIN_DEFAULT_EMAIL=pgadmin4#pgadmin.org
- PGADMIN_DEFAULT_PASSWORD=admin
ports:
- "5050:80"
depends_on:
- postgresql
solr:
build:
context: ./solr/
dockerfile: Dockerfile
restart: always
ports:
- "8983:8983"
volumes:
- data:/var/solr
volumes:
data:
update:
It worked when I downgraded to docker desktop 2.3.0.4
Updated Answer:
Since VSCode Docker 1.14.0 you can now set the Docker executable path in the settings, which should help in most cases.
Old Answer (Option was removed from Docker Desktop):
The Desktop Docker Version 2.4.0.0 is working for me after I did deactivate the feature Enable cloud experience. You can find it under Preferences --> Command Line.
If you are still experience the problem, you may try a clean remove and install of Docker and also make sure that Docker is actually running, see other possible solution(s) here.
History of GitHub Issues:
https://github.com/docker/for-mac/issues/4956
https://github.com/microsoft/vscode-docker/issues/2366
https://github.com/microsoft/vscode-docker/issues/2578
https://github.com/microsoft/vscode-docker/issues/2894
Status (2021-06-22): VSCode Version 1.57.0 seems to have fixed the issue again.
You might get the following error message simply because you did not start Docker just yet
exec: "com.docker.cli": executable file not found in $PATH
In my case the problem was I had installed and then crudely removed the docker compose cli. This resulted in the above error to start popping up.
I got the compose CLI back using instructions from https://docs.docker.com/cloud/ecs-integration/#install-the-docker-compose-cli-on-linux and running (as root):
curl -L https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh | sh
This fixed it for me.
Note: I would not recommend installing docker-compose cli to fix this issue, but to share some insights in case this is applicable to you as well.
Ensure that docker CLI is installed not just docker desktop on Linux. YOu can install it using:
sudo apt install docker.io
Update: The "cloud experience" no longer exists even as an experimental feature in Docker Desktop v3.2.1. This should no longer be an issue.
If you continue to see this problem on a newer version, you will need to downgrade to Docker v3.1.0, disable the cloud experience feature, then upgrade to the newest version.
Had the exact same issue. Was fixed after starting the upgraded docker first, then running this command.
dostarr#DOSTARR-M-38LF ~ % docker run busybox
exec: "com.docker.cli": executable file not found in $PATH
<started docker>
dostarr#DOSTARR-M-38LF ~ % docker run busybox
dostarr#DOSTARR-M-38LF ~ %
I had the same problem when trying to run minikube tunnel, and since I didn't want to re-install anything, I ended up running it from the docker bin path (on Windows it's in 'C:\Program Files\Docker\Docker\resources\bin') and it worked.
An alternative to Docker Desktop is colima, container runtimes on macOS (and Linux) with minimal setup.
# Homebrew
brew install colima docker
colima start
Now, you can use the docker commands as before.
For docker compose commands, you have to install:
brew install docker-compose
if already have installed docker, it may not have started. So type in terminal,"docker run -d -p 80:80 docker/getting-started" and it should solve the issue.

docker-compose on Windows 10: cannot find image?

I'm developing locally on a Windows 10 PC, and have Docker images installed on drive D.
Running the command 'docker images' shows...
When I run a 'docker-compose up' command I'm getting the following error...
Pulling eis-config (eis/eis-config:)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.
Continue with the new image? [yN]
Any idea why this is happening? (Could it be that the docker-compose is looking for the images on docker-hub, rather than locally?
The 'docker-compose.yml' file is shown below...
version: "3.7"
services:
eis-config:
image: eis/eis-config
ports:
- "8001:8001"
eis-eureka:
image: eis/eis-eureka
ports:
- "8761:8761"
depends_on:
- eis-config
eis-zuul:
image: eis/eis-zuul
ports:
- "8080:8080"
depends_on:
- eis-eureka
gd-service:
image: eis/gd-service
ports:
- "8015:8015"
depends_on:
- eis-eureka
run
docker-compose kill
docker-compose down
docker-compose up
should fix your issue, most likely you have an old container (running or not) that's causing the problem
You are running eis/eis-config without an Image tag, so latest is implicitely assumed by docker. You don't have an Image eis/eis-config with latest tag. So either build your Image with latest tag, or run image: eis/eis-config:0.0.1-SNAPSHOT
It seems like you missed an entry for the eis/eis-config service in the yml file, once check your yml file and regenerate the image for that service.
Where are you trying to run those images, locally in your machine or on a remote server?
once look at this link Error running containers with docker-compose, error pulling images from my private repo in dockerhub

use nvidia-docker from docker-compose

I would like to run 2 docker images with docker-compose.
one image should run with nvidia-docker and the other with docker.
I've seen this post use nvidia-docker-compose launch a container, but exited soon
but this is not working for me(not even running only one image)...
any idea would be great.
UPDATE : please check nvidia-docker 2 and its support of docker-compose first
https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#do-you-support-docker-compose
(I'd first suggest adding the nvidia-docker tag).
If you look at the nvidia-docker-compose code here it only generates a specific docker-file for docker-compose after a query of the nvidia configuration on localhost:3476.
You can also make by hand this docker-compose file as they turn out to be quite simple, follow this example, replace 375.66 with your nvidia driver version and put as many /dev/nvidia[n] lines as you have graphic cards (did not try to put services on separate GPUs but go for it !):
services:
exampleservice0:
devices:
- /dev/nvidia0
- /dev/nvidia1
- /dev/nvidiactl
- /dev/nvidia-uvm
- /dev/nvidia-uvm-tools
environment:
- EXAMPLE_ENV_VARIABLE=example
image: company/image
volumes:
- ./disk:/disk
- nvidia_driver_375.66:/usr/local/nvidia:ro
version: '2'
volumes:
media: null
nvidia_driver_375.66:
external: true
Then just run this hand-made docker-compose file with a classic docker-compose command.
Maybe you can then compose with non nvidia dockers by skipping the nvidia specific stuff in the other services.
Additionally to the accepted answer, here's my approach, a bit shorter.
I needed to use the old version of docker-compose (2.3) because of the required runtime: nvidia (won't necessarily work with version: 3 - see this). Setting NVIDIA_VISIBLE_DEVICES=all will make all the GPUs visible.
version: '2.3'
services:
your-service-name:
runtime: nvidia
environment:
- NVIDIA_VISIBLE_DEVICES=all
# ...your stuff
My example is available here.
Tested on NVIDIA Docker 2.5.0, Docker CE 19.03.13 and NVIDIA-SMI 418.152.00 and CUDA 10.1 on Debian 10.

Resources