Tag: python

Run python website on docker

I have created a Python + Flask website on docker. If I do “docker-compose up” the website is available on 0.0.0.0:5000. I have tagged and pushed the container to docker and I tried doing docker run mydomain/mycontainer from a different computer. It starts downloading everything, but at the end it displays Status: Downloaded newer image […]

How to run Python Scripts on Mac Terminal using Docker with Tensorflow?

I just got a Mac and shifted from Windows and installed Tensorflow using Docker and everything is working fine, but I want to run a python script that I have from before. Is there any way to run a python script in docker on a Mac, using the terminal?

how to bind ports with docker-py

I try to start a docker container with docker-py (Version 1.3.1). I want to map the container internal ports to different ports but fail to expose them properly. I do this like so: def start_container(client, host_config, image_tagged_name, command): print (“create_host_config”, host_config.binds, host_config.port_bindings) the_host_config = create_host_config(binds = host_config.binds, port_bindings = host_config.port_bindings); the_ports = host_config.port_bindings.values(); print (“create_container”, […]

making docker containers communicate through port

Im trying to create 2 docker containers and run them in a way they can communicate with each other through a port in localhost. I have created 2 python files as sender and receiver. When Im running them without docker they communicate nicely. But with docker they are not running properly. Sender Python script #!/usr/bin/python […]

Getting error ImportMismatchError while running py.test

When I am running tests locally its working fine, but after creating the docker and running inside the container I am getting below error. /usr/local/lib/python3.5/site-packages/_pytest/config.py:325: in _getconftestmodules return self._path2confmods[path] E KeyError: local(‘/apis/db/tests’) During handling of the above exception, another exception occurred: /usr/local/lib/python3.5/site-packages/_pytest/config.py:356: in _importconftest return self._conftestpath2mod[conftestpath] E KeyError: local(‘/apis/db/tests/conftest.py’) During handling of the above exception, […]

Gunicorn can't find staticfiles after dockerization

I am using docker 17.05.0-cs edge on Ubuntu 17.04 Zesty. I have a gunicorn/Django app that I built here. It runs fine before being dockerized, but gunicorn can’t see the staticfiles after docker build. Here is the Dockerfile: # Dockerfile # FROM base image to build upon FROM phusion/baseimage # RUN install python and pip […]

How to Install/add jdk 7 in Docker Container

I have created a docker image with Python as base in my Ubuntu 14.04 machine. Docker version I am using is 1.12.3. Base OS of Python used in image is Debian. I also require JAVA 7 (JDK 7) in my docker image. There are few Python scripts in it and also few scripts which requires […]

Connection Refused Docker Run

I’m getting a connection refused after building my Docker image and running docker run -t imageName Inside the container my python script is making web requests (external API call) and then communicating over localhost:5000 to a logstash socket. My dockerfile is really simple: FROM ubuntu:14.04 RUN apt-get update -y RUN apt-get install -y nginx git […]

Is there a way to automatically activate a virtualenv as a docker entrypoint?

I have a flask app inside of a docker container. I would like to use the python package zappa to deploy that app to Amazon Web Services. Unfortunately zappa requires that it and all of my apps dependencies be installed in a python virtual environment. So I have rebuilt my docker image and moved everything […]

How to run Python Flask within a Docker container [duplicate]

This question already has an answer here: Deploying a minimal flask app in docker – server connection issues 2 answers

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