Open mmkk20158 opened 4 months ago
Hey, i guess this is not a question about script server, but rather docker and container management. Your goal is to write a script which will work inside a docker container. Script server will just give a web access to this script. I think this guide might be helpful https://www.reddit.com/r/docker/comments/169hnti/quick_guide_how_to_control_a_docker_host_from/
hey thanks! yeah i know i can use the api but was just curious if there was some other way without opening a port.
thanks again!
Yep, unfortunately Script server doesn't have any special features for docker
Yep, unfortunately Script server doesn't have any special features for docker
what's the recommended way to add curl to the container? i tried a volume binding but then all of the dependancis aren't there
I just used the python3 that was included ayway, for anyone in the future
#!/usr/local/bin/python3
import http.client
palworld_container = "71cc9de67538"
docker_host = "172.17.0.1"
docker_port = 2375
restart_path = f"/containers/{palworld_container}/restart"
print("connecting to docker host...")
connection = http.client.HTTPConnection(docker_host, docker_port, timeout=100)
print(f"REST API call: POST {restart_path}")
connection.request("POST", restart_path)
response = connection.getresponse()
print("Resonse:")
if ( response.status == 204):
print("Success")
else:
print(f"{response.status} {response.reason}")
Thanks a lot @mmkk20158 !
Yep, unfortunately Script server doesn't have any special features for docker
what's the recommended way to add curl to the container? i tried a volume binding but then all of the dependancis aren't there
You could use a staging script* once the container is up to install additional packages or customize your image with docker compose to add the packages you need.
#!/bin/bash
# placed at shared directory with the container
apt update
apt install package1 package2 package3
apt clean
So I installed this on my docker server and i'd like people to be able to restart a service on another docker. obviosly since this is inside a docker itself it doens't have access to the hosts info.
basically i'm hosting a palworld server and i want my users to be able be able to restart the docker container for updates / mods / etc