Docker Community Forums

Share and learn in the Docker community.

Docker Run command from CGI script

I’m trying to set up 2 docker containers.
Web-Serv container is a httpd based linux apache server, CGI is enabled and running, docker is installed on this container. When running it binds to the .sock of the host.
Job-Serv container is an alpine based image which I want to spin up on demand from Web-Serv

Everything is working apart from running the docker run command from the CGI script.

This is launched as a separate shell script from the CGI script and to ensure it’s running I’ve added a touch command. The contents of the shell script is as follows:


touch /tmp/marksfile
docker run -i -t --mount source=docker_data,target=//home/data --publish 29002:28000 --name testy_test_2 nxopen_hello_world:1.0 ./

I’ve switched user to daemon (which is the user that the CGI script runs as) and ensured they have permissions to run the docker run ... command and all works properly.

This one line fails to run if launched from the web page using the CGI script.
Any advice on why this isn’t working and what I could do to fix would be great.