yugabyte-db
yugabyte-db copied to clipboard
[Docs] docker-compose.yaml example not working in some enviromnents
Description
Two issues were reported regarding the example docker-compose.yaml in https://docs.yugabyte.com/latest/deploy/docker/docker-compose/
- port bind error (see https://forum.yugabyte.com/t/docker-compose-connection-refused/1319/3). Solution: add hostname
-
FATAL: lock file "/tmp/.yb. /.s.PGSQL.5433.lock" already exists
after stopping and restarting the container. Solution: I addrm -rf /tmp/.yb* ;
before calling tserver. Example: https://github.com/FranckPachot/ybdemo/blob/main/docker/yb-rf3/docker-compose.yaml
Solution: I add rm -rf /tmp/.yb* ; before calling tserver
How do you do that? In yugabytedb/yugabyte:latest
the entrypoint is set to tini, which allows only one command.
I've figured out something like this:
command: [ "sh", "-c",
"/usr/bin/rm -rf /tmp/.yb* && exec /home/yugabyte/bin/yb-tserver \
--fs_data_dirs=/mnt/tserver \
--start_pgsql_proxy \
--tserver_master_addrs=... \
--rpc_bind_addresses=..." ]
I think it should be handled by some wrapper in the container itself.
I had same problem many times. please have yugabyted do the removal automatically. TIA.
Here is my docker-compose with a lengthy command to overcome this issue and others. It is only one service definition, using yugabyted
, that can be scaled to more replicas: https://github.com/FranckPachot/yb-compose so it's very docker friendly 🙂
Here is my docker-compose with a lengthy command to overcome this issue and others. It is only one service definition, using yugabyted, that can be scaled to more replicas: https://github.com/FranckPachot/yb-compose so it's very docker friendly
@FranckPachot Thank you for a link to your solution (I'm hitting same problem). I'm looking at your compose and I don't understand how it solves the lock file issue. How is it cleaning up the lock? Am I just missing something obvious?
@nlflint great question. It seems that I removed the rm
thinking it is not needed:
-bash-4.2# docker run -d yugabytedb/yugabyte:2024.1.1.0-b137 yugabyted start --background=false
55f910cf4a6188092b64528417d1a73d6a70b5696a04c9d11f4ff3f0e2f52989
-bash-4.2# find / -name ".s.PGSQL.5433" -ls
213744479 0 srwx------ 1 root root 0 Aug 20 07:30 /var/lib/docker/overlay2/a8f71c1e376f0922c8e3191e3d9d03e844553b54625df468e8978310cf612310/diff/tmp/.yb.172.17.0.2:5433/.s.PGSQL.5433
213744479 0 srwx------ 1 root root 0 Aug 20 07:30 /var/lib/docker/overlay2/a8f71c1e376f0922c8e3191e3d9d03e844553b54625df468e8978310cf612310/merged/tmp/.yb.172.17.0.2:5433/.s.PGSQL.5433
-bash-4.2# docker stop 55f910cf4a6188092b64528417d1a73d6a70b5696a04c9d11f4ff3f0e2f52989
55f910cf4a6188092b64528417d1a73d6a70b5696a04c9d11f4ff3f0e2f52989
-bash-4.2# docker start 55f910cf4a6188092b64528417d1a73d6a70b5696a04c9d11f4ff3f0e2f52989
55f910cf4a6188092b64528417d1a73d6a70b5696a04c9d11f4ff3f0e2f52989
-bash-4.2# find / -name ".s.PGSQL.5433" -ls
213744477 0 srwx------ 1 root root 0 Aug 20 07:31 /var/lib/docker/overlay2/a8f71c1e376f0922c8e3191e3d9d03e844553b54625df468e8978310cf612310/diff/tmp/.yb.172.17.0.2:5433/.s.PGSQL.5433
213744477 0 srwx------ 1 root root 0 Aug 20 07:31 /var/lib/docker/overlay2/a8f71c1e376f0922c8e3191e3d9d03e844553b54625df468e8978310cf612310/merged/tmp/.yb.172.17.0.2:5433/.s.PGSQL.5433
-bash-4.2# docker exec -it 55f910cf4a6188092b64528417d1a73d6a70b5696a04c9d11f4ff3f0e2f52989 bash -c 'postgres/bin/pg_isready -h $(hostname)'
55f910cf4a61:5433 - accepting connections
-bash-4.2#
But you say you encountered the problem?
(update)
🤦♂️ Now I remember when the problem occurs: when the IP changes on container restart.
I just added the rm
to yb-compose
but I don't think it work when the IP changes anyway because it is set in the configuration