Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
Create docker container from flask request in uWSGI instance

I have a docker container that is setup to perform some given actions with selenium. My goal is to have the docker container be created when a request is received for a certain endpoint created using flask. The flask app has been setup with uWSGI and Nginx using this tut.

When the endpoint receives a request it is suppose to run the bash script ./run.sh:

#!/bin/bash

ID=$1

docker run --rm \
        -v $(pwd)/code:/code \
        -v /etc/hosts:/etc/hosts \
        selenium \
        python3 \
        /code/main.py ${ID}

I can successfully make a call to the endpoint using the IP given from digital ocean but when it gets to the point where it needs to run docker it says:

docker: command not found

Note, I can go into the virtualenv manually, run python app.py, send request to flask endpoint and the docker container is created and everything works great.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You probably need to add a PATH variable to your bash script which includes the location of your docker executable. The user running NGINX likely doesn't have a path set.

PATH=$PATH:/usr/local/bin:/usr/bin

Also you'll need to ensure that the user running NGINX has permission to use docker, so add them to the docker group.

If this is a public service, then I would think carefully about whether you really want internet users to be launching containers on your server, does $1 come from user input?

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda