Tag: python

ImportError: cannot import name <package> in pods while restarting pod fixes

Note that this is not specific to below import as I have observed for different pods. Pod throws import error although the package is shown successfully installed with required version. If if delete and recreate the pod, the error goes away. This has happened with couple of pods with different packages and goes away on […]

Headless browser capable of popup handling?

I tried https://hub.docker.com/r/wernight/phantomjs/ and https://github.com/SeleniumHQ/docker-selenium/tree/master/StandaloneChrome Docker images with browsers (first one is truly headless and the second one incorporates real chrome running under xvfb) and seems like both of them do no support javascript popups (via window.open) – because there is always only one element in driver.window_handles. May be I should try it without docker, […]

How to run Python server on Docker's container

I want to run Python HTTP server on docker container. My DockerFile looks like this: FROM continuumio/anaconda3:latest RUN apt-get -y update RUN apt-get -y install linux-headers-amd64 build-essential libc-dev gcc RUN conda install –yes gcc RUN conda install –yes numpy RUN conda install –yes scipy RUN conda install –yes gensim RUN pip install annoy RUN conda […]

Use Docker to compile and run untrusted code in Django App [closed]

I am building a Django web application to compile and run untrusted code in different languages submitted by user. The steps behind compilation are : Take the code from editor provided on run action store in database with a file name run it using bash script. Since there are problems of security, of directly running […]

PostgreSQL on AWS ECS: psycopg2.OperationalError invalid port number 5432

I’m having a problem with database connection via psycopg2 on AWS ECS. I have an App container and a DB container. Containers are linked. The App has an entrypoint script that checks if the DB is up before starting an app server. $ until psql -h “$DB_HOST” -U “$DB_USER” -c ” && >&2 echo “Postgres […]

How do I compile python for Alpine?

Background context (why): We have a project written in Python, running on a containerised platform. We are using a Network File System (OpenStack based) to store images and mounts, this is amazingly useful in terms of point in time restores, but the size of the Docker images is starting to kill us in deployments. The […]

How to mount network location in docker

I am using docker (1.12.3) in my Ubuntu machine. I am running a python script which will send its output to a windows network path (\\my_win_path\c). I am able to execute the python script. Can someone help me with the second part (i.e. sending the output(its a text file) to network location). This network location […]

How to restart a process inside a container / Restarting PhpStorm using original restart.py

I’m making an image with PhpStorm (as a part of my effort to build portable development environment). Everything runs pretty smoothly except that PhpStorm can’t restart itself. It uses bin/restart.py script for that purpose which doesn’t work when dockerized. This is the body the script: #!/usr/bin/env python # Waits for the parent process to terminate, […]

using smart_open lib with a s3 docker image

I’m trying to use the python lib smart_open and a s3 docker image to run some functional tests locally. Docker runs on port 4569 and I have a test bucket created: aws s3 ls –endpoint-url http://localhost:4569 2017-04-03 15:17:38 my-bucket Example script looks like this: import smart_open with smart_open.smart_open(‘s3://my-bucket/mykey.txt’, ‘wb’, host=”″) as fout: for line in […]

How to determine cause of slow requests in Flask?

I’m developing a Flask web app with Docker and I’ve noticed that it hangs every few requests. Sometimes the request will completely time out and I’ll receive a message from Docker saying: [1] [CRITICAL] WORKER TIMEOUT (pid:8). How can I find out the source of these slowdowns? I’ve already enabled response time tracking and it […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.