feat(docker-hoster): Update default socket path and Dockerfile CMD

The default docker socket path in hoster.py has been updated from "tmp/docker.sock" to "/tmp/docker.sock" to match the Dockerfile's VOLUME mounting. The Dockerfile has also been updated to use ENTRYPOINT and CMD for better container execution, and the README.md has been updated with the new image name.
This commit is contained in:
mmmohebi 2025-11-18 13:01:45 +03:30
parent e3bc1cd0b0
commit 19a2c3509c
3 changed files with 5 additions and 3 deletions

View File

@ -8,4 +8,6 @@ RUN mkdir /hoster
WORKDIR /hoster WORKDIR /hoster
COPY hoster.py /hoster/ COPY hoster.py /hoster/
CMD ["python3", "-u", "hoster.py"] ENTRYPOINT ["python3", "-u", "hoster.py"]
CMD ["/tmp/docker.sock", "/tmp/hosts"]

View File

@ -7,7 +7,7 @@ hoster is intended to run in a Docker container:
docker run -d \ docker run -d \
-v /var/run/docker.sock:/tmp/docker.sock \ -v /var/run/docker.sock:/tmp/docker.sock \
-v /etc/hosts:/tmp/hosts \ -v /etc/hosts:/tmp/hosts \
dvdarias/docker-hoster ghcr.io/mrmohebi/docker-hoster:latest
The `docker.sock` is mounted to allow hoster to listen for Docker events and automatically register containers IP. The `docker.sock` is mounted to allow hoster to listen for Docker events and automatically register containers IP.

View File

@ -183,7 +183,7 @@ def update_hosts_file():
def parse_args(): def parse_args():
parser = argparse.ArgumentParser(description='Synchronize running docker container IPs with host /etc/hosts file.') parser = argparse.ArgumentParser(description='Synchronize running docker container IPs with host /etc/hosts file.')
parser.add_argument('socket', type=str, nargs="?", default="tmp/docker.sock", help='The docker socket to listen for docker events.') parser.add_argument('socket', type=str, nargs="?", default="/tmp/docker.sock", help='The docker socket to listen for docker events.')
parser.add_argument('file', type=str, nargs="?", default="/tmp/hosts", help='The /etc/hosts file to sync the containers with.') parser.add_argument('file', type=str, nargs="?", default="/tmp/hosts", help='The /etc/hosts file to sync the containers with.')
return parser.parse_args() return parser.parse_args()