I am getting an error while
docker-compose up
when setting up the first project.
Below is the error
Docker-Compose-Error-Screenshot from 2023-04-20 15-47-19
723×310 51.6 KB
The error is happening on
Ubuntu 20 LTS
Hi
@Fred_Kwebiha
- welcome to the forum! Thanks a bunch for making your first post here - it’s always great seeing a member of the community reach out here so we can help them and also so others can learn from your post.
Looking at your errors, it looks like the
${PWD}
values aren’t getting expanded so the two environment variables of
DOCKER_CONFIG_PATH
and
CHT_COMPOSE_PATH
are being passed in as
NULL
values to docker compose.
Assuming you’re following
the app developer setup
steps, a fix should be to replace
${PWD}
with the current path of
~/cht-4-app-developer
. Try running these two commands:
cd ~/cht-4-app-developer
CHT_COMPOSE_PROJECT_NAME=app-devl COUCHDB_SECRET=foo DOCKER_CONFIG_PATH=~/cht-4-app-developer COUCHDB_DATA=~/cht-4-app-developer/couchd CHT_COMPOSE_PATH=~/cht-4-app-developer COUCHDB_USER=medic COUCHDB_PASSWORD=password docker-compose up
Please let us know if that fixes it!
Oh no! I’m sorry the issue is still persisting. Let’s try:
Giving the result of docker volume ls
Can copy your terminal text into this thread? I’d like to see everything from start to finish. I’ve pasted mine in below as an example.
If this is too frustrating, we’ve created the CHT Docker Helper which should automate a lot of the manual steps you’re facing problems with.
Cheers,
My terminal text running the command:
$ mkdir ~/cht-4-app-developer && cd ~/cht-4-app-developer
curl -s -o docker-compose.yml https://raw.githubusercontent.com/medic/cht-upgrade-service/main/docker-compose.yml
curl -s -o cht-core.yml https://staging.dev.medicmobile.org/_couch/builds_4/medic%3Amedic%3Amaster/docker-compose/cht-core.yml
curl -s -o cht-couchdb.yml https://staging.dev.medicmobile.org/_couch/builds_4/medic%3Amedic%3Amaster/docker-compose/cht-couchdb.yml
$ cd ~/cht-4-app-developer
CHT_COMPOSE_PROJECT_NAME=app-devl COUCHDB_SECRET=foo DOCKER_CONFIG_PATH=~/cht-4-app-developer COUCHDB_DATA=~/cht-4-app-developer/couchd CHT_COMPOSE_PATH=~/cht-4-app-developer COUCHDB_USER=medic COUCHDB_PASSWORD=password docker-compose up
[+] Running 1/0
⠿ Container cht-4-app-developer-cht-upgrade-service-1 Created 0.0s
Attaching to cht-4-app-developer-cht-upgrade-service-1
cht-4-app-developer-cht-upgrade-service-1 | Listening on port 5008
cht-4-app-developer-cht-upgrade-service-1 | networks:
cht-4-app-developer-cht-upgrade-service-1 | cht-net:\
The results in the Terminal are as below.
fred@fred-VirtualBox:~$ cd ~/cht-4-app-developer/
fred@fred-VirtualBox:~/cht-4-app-developer$ CHT_COMPOSE_PROJECT_NAME=app-devl COUCHDB_SECRET=foo DOCKER_CONFIG_PATH=~/cht-4-app-developer COUCHDB_DATA=~/cht-4-app-developer/couchd CHT_COMPOSE_PATH=~/cht-4-app-developer COUCHDB_USER=medic COUCHDB_PASSWORD=password sudo docker-compose up
WARNING: The DOCKER_CONFIG_PATH variable is not set. Defaulting to a blank string.
WARNING: The CHT_COMPOSE_PATH variable is not set. Defaulting to a blank string.
Creating cht-4-app-developer_cht-upgrade-service_1 ... error
ERROR: for cht-4-app-developer_cht-upgrade-service_1 Cannot create container for service cht-upgrade-service: create .: volume name is too short, names should be at least two alphanumeric characters
ERROR: for cht-upgrade-service Cannot create container for service cht-upgrade-service: create .: volume name is too short, names should be at least two alphanumeric characters
ERROR: Encountered errors while bringing up the project.
fred@fred-VirtualBox:~/cht-4-app-developer$ sudo docker volume ls
DRIVER VOLUME NAME
fred@fred-VirtualBox:~/cht-4-app-developer$
@Fred_Kwebiha - I was doing some testing and have reproduced your original error on an older version of docker. Can you let me know which version of Docker and Docker Compose you’re running? Do so by showing the results of these commands (some may fail):
docker -v
docker-compose -v
docker compose -v
Here’s what I see when I run these:
Docker version 23.0.5, build bc4487a
Docker Compose version v2.11.2
Docker version 23.0.5, build bc4487a
I am still getting issues even after upgrading docker-compose to the latest version
docker-compose --version
Docker Compose version v2.17.3
cd ~/cht-4-app-developer
CHT_COMPOSE_PROJECT_NAME=app-devl COUCHDB_SECRET=foo DOCKER_CONFIG_PATH=~/cht-4-app-developer COUCHDB_DATA=~/cht-4-app-developer/couchd CHT_COMPOSE_PATH=~/cht-4-app-developer COUCHDB_USER=medic COUCHDB_PASSWORD=password sudo docker-compose up
[sudo] password for fred:
WARN[0000] The "DOCKER_CONFIG_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "CHT_COMPOSE_PATH" variable is not set. Defaulting to a blank string.
2 error(s) decoding:
* error decoding 'Volumes[1]': invalid spec: :/config: empty section between colons
* error decoding 'Volumes[2]': invalid spec: :/docker-compose: empty section between colons
@mrjones I have tried the helper, it also fails. below is the output
fred@fred-VirtualBox:~/cht-4-app-developer$ ./cht-docker-compose.sh
No project found, follow the prompts to create a project .env file.
Would you like to initialize a new project [y/N]? y
How do you want to name the project? test
Downloading compose files ... done
[+] Running 8/8
✔ cht-upgrade-service 7 layers [⣿⣿⣿⣿⣿⣿⣿] 0B/0B Pulled 174.5s
✔ 9621f1afde84 Pull complete 15.9s
✔ 79ef350afea0 Pull complete 87.8s
✔ d3ad581b5912 Pull complete 91.8s
✔ ee1cc07adb60 Pull complete 92.3s
✔ 6ff0c1acf8d2 Pull complete 155.6s
✔ 8c682c1a2d58 Pull complete 155.8s
✔ 4e97924f9b18 Pull complete 161.5s
[+] Running 2/2
✔ Network test-cht-net Cre... 0.5s
✔ Container test-dir-cht-upgrade-service-1 Started 2.2s
Starting project "test". First run takes a while. Will try for up to five minutes................................................................................................................................................................................................................................................................................................................
\033[0;31mFailed to start - check docker logs for errors and try again.\033[0m
@Fred_Kwebiha - I’m so sorry to hear the problem is persisting! While it’s still a feature in development, can you try the beta of the DEBUG feature of the Docker Helper? Here’s how:
go into the directory where you have CHT Core checked out
switch to the dev branch with: git fetch origin; git checkout cht4-compose-helper-debug
follow the normal steps to start the docker helper, but run it with DEBUG=true ./cht-docker-compose.sh