Open Joly0 opened 2 years ago
https://support.cubecoders.com/thread/help-on-setting-amp-in-a-docker-container/ some points where outlined here already 2 years ago (i posted my own amp container there back then lol)
I have wondered the same thing. I will have to look into this
I had some time tinkering with this idea though i dont get it to work as intended.
I installed docker inside the container and added the hosts docker socket through a volume (that should in theory work) but amp was unable to create instances like that.
I am not sure, if amp maybe completly ignores the socket and just directly uses docker itself (which might be plausible) and would result in this feature to fail, unless we come up with a proper workaround.
Other than that there are several projects like DinD (Docker-in-Docker) which sound like they are what we need, but it also sounds like a big change to the docker as it is currently.
Maybe i can further test this in the next days/weeks but this is, unfortunately, what i found
This would be a brilliant change, and probably would alleviate most of the compatibility issues this container seems to have with new games.
Seemingly the Docker-in-Docker container might fit the bill. I wonder how difficult it would be to rebase this container using that as the base?
I had some time tinkering with this idea though i dont get it to work as intended.
I installed docker inside the container and added the hosts docker socket through a volume (that should in theory work) but amp was unable to create instances like that.
I am not sure, if amp maybe completly ignores the socket and just directly uses docker itself (which might be plausible) and would result in this feature to fail, unless we come up with a proper workaround.
Other than that there are several projects like DinD (Docker-in-Docker) which sound like they are what we need, but it also sounds like a big change to the docker as it is currently.
Maybe i can further test this in the next days/weeks but this is, unfortunately, what i found
There is a reason it didn't work for you, it needs more then just the docker socket. a lot more.
If you want to get this to work you need to do a few things:
host.ip:port
so the outside container can reach the AMP auth end point ***startup.sh
in itadd the following stuff to that file (it will install docker and set some things up on startup to allow the management of instances to work):
#!/bin/bash
# make sure change `groupmod -g 281 docker` to match the group ID of docker on your host so the group ID is identical between the container and host.
apt update; apt -y install apt-transport-https ca-certificates curl software-properties-common; curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -; add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"; apt -y install docker-ce; usermod -aG docker amp; groupmod -g 281 docker; apt -y install nginx
cat > /etc/nginx/sites-enabled/default <<EOF
server {
listen 8081;
location / {
proxy_pass http://host-ip:8081;
}
}
# you can create multiple copies of this block, 1 for each instance and the port it uses. the ports must match the port each instance uses. you can create as many as you think you will need, server blocks that are not used will not cause an issue.
# be sure to change the host-ip part to your hosts IP address
server {
listen 8082;
location / {
proxy_pass http://host-ip:8082;
}
}
EOF
service nginx restart
Some images: * ** *** ****
It may be worth looking into nestybox/sysbox for this - it's a lot more secure than DinD, and less kludgey than other workarounds. It would require changes to the base image to add things like systemd, but once implemented it should be stable and secure - it doesn't even need to be run in a privileged container!
It may be worth looking into nestybox/sysbox for this - it's a lot more secure than DinD, and less kludgey than other workarounds. It would require changes to the base image to add things like systemd, but once implemented it should be stable and secure - it doesn't even need to be run in a privileged container!
My solution is not DinD it only installs Docker to use the binary to talk to the Docker socket on the host system which is bind mounted to the container. Also my solution does not require a privileged container.
Its possible for containers (such as portainer) to hook into the hosts docker engine through a docker.sock. Using that, those containers are able to create more containers on the host os.
Amp already has the option to create instances in docker containers. It would be great (especially for opening ports) if it would be possible to have a master instance with this image running ads and telling it to create instances in containers using a docker.sock which creates them on the host os.
Though i am not sure, if this does work currently with amp (or ever), if some capabilities are missing or not (havent tested, this is just a suggestion for something it might be useful to look into). In theory this could work, which would mean, we just need this image for ads (smaller size, better maintainability and more) and could use the official ones for the game instances.