Closed csd-was-taken closed 1 month ago
I can't seem to reproduce this. Logs from Ubuntu:
Gracefully stopping... (press Ctrl+C again to force)
Aborting on container exit...
[+] Running 1/1
β Container hlds-docker-hlds-1 Stopped 10.5s
canceled
After cancelling the container the hlds client also shuts down. This might be a system specific thing, but hard to tell... π€
You may want to try pruning any lingering containers as it may cause the Docker process to slow down. You can try docker system prune -all
to nuke everything, but bare in mind it will also kill the active container too and force you to need to re-download everything.
oh sorry, i forgot to mention i was doing compose up with the -d flag, to start it detached. from what i can find online, once i attach back into the container, ctrl p q should spit me back out of the container
if i don't start detached, then ctrl c just kills it as you said
Ah gotcha. I don't think this is a problem with the container directly, just how the commands are being used. The following worked for me using the docker run
command in the README (I updated this to add the -ti
flag), and then hitting Control + P, Control + Q to exit the attached process without terminating the container.
docker run -d -ti \
--name hlds \
-v "$(pwd)/config:/temp/config" \
-v "$(pwd)/mods:/temp/mods" \
-p 27015:27015/udp \
-p 27015:27015 \
-p 26900:26900/udp \
-e GAME=${GAME} \
jives/hlds:valve \
"+log on +rcon_password changeme +maxplayers 12 +map crossfire"
Results:
root@docker2503onubuntu2204-s-1vcpu-1gb-nyc1-01:~/hlds-docker# docker attach 9eccb6926216
read escape sequence
root@docker2503onubuntu2204-s-1vcpu-1gb-nyc1-01:~/hlds-docker#
I'm also able to execute any combination of stop, kill, etc via docker stop <container-id>
, it does take a few seconds though for the server shutdown command to finish beforehand. It logs back the container id once its done, and you can see it no longer running via docker ps
.
root@docker2503onubuntu2204-s-1vcpu-1gb-nyc1-01:~/hlds-docker# docker stop 9eccb6926216
9eccb6926216
root@docker2503onubuntu2204-s-1vcpu-1gb-nyc1-01:~/hlds-docker# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
For the inputs to work correctly with docker compose, start the server with docker compose -d
, and then attach to the container with docker attach --sig-proxy=false <container-id>
. You can then use Control + C to exit the container instance without killing it. You can then use docker kill|stop|etc <container-id>
to terminate the process. Not sure why compose behaves differently to run, but they are slightly different products I guess so perhaps that's why.
Hope this helps!
What happened?
the default code to escape a docker container is ctrl p q, but something about the HLDS just eats that input instead of letting docker take care of it. currently i can just press ctrl c three times and that works, but it feels wrong.
similarly (but this might just be an HLDS thing, unrelated to the docker image), i cant figure out how to gracefully exit the container. i've tried every variation of
stop
,kill
,quit
,end
i can think of, but there's nothing. ideally ctrl c would take care of that, which is the behavior when i run the HLDS executable directly. so i justdocker kill
it.if any of this is intended/known won't fix, it should probably be put in the docs somewhere (or maybe i just missed that)
Approach
I am using a pre-built image on Dockerhub (jives/hlds)
What games are you trying to run?
Half-Life Deathmatch (valve)
Do you have custom server configs or mods installed?
Docker Logs
No response
Docker Command
No response