Tag: python

no json module when running python script in docker container

I’m trying to run a simple python script that takes a json string as an argument in a docker container. However I get the following error: Traceback (most recent call last): File “/root/simple.py”, line 2, in <module> import json ImportError: No module named json I’m running the standard ubuntu:12.04 image. Here’s how I call up […]

Docker container network failed Occasionally

I used docker container that using logstash. But, Sometimes container network failed. => ping google.co.kr cannot resolve google.co.kr : Unknown host. This symptom occurs in a week interval, while it works. container linux version Linux 81ed1c4b8bc9 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux docker i/o version Docker version 1.3.2, […]

centralize python imports for docker builds efficency?

Can I do this in python? $ file.py import project1.allmodules def task1(): print “ok” def task2(): ~/project1$ allmodules.py import sys, json, re, time,os from iron_mq import * from twilio.rest import TwilioRestClient from time import sleep from pythonlib.ltvlogger import * from requests basically If i want to add a module to an app that is in […]

docker-compose startup error cannot import name _thread

For all the good fellars out there who’re trying to get started on docker-compose. I’m running OS X El Capitan (10.11). The system ships with python 2.7. Trying to replace the system python to python 3 isn’t recommended because many core systems depend on python 2 libraries. Installed ‘Docker’ for Mac and ‘docker-compose’ using docker […]

Microservices with Flask [closed]

We are building a pretty large system that will expose several different REST API’s, contain a Mongodb database, a Redis cache layer, and a backend computational library. Currently we are using Flask-Restful for building our API’s, but for various reasons we also need to run another instance of Flask that provides database resources, and another […]

`docker run -v` doesn't work as expected

I’m experimenting with a Docker image repository cloned from https://github.com/amouat/example_app.git (which is based on another repository: https://github.com/mrmrcoleman/python_webapp). The structure of this repository is: ├── Dockerfile ├── example_app │ ├── app │ │ ├── __init__.py │ │ └── views.py │ └── __init__.py ├── example_app.wsgi After building this repository with tag example_app, I try to mount a […]

Proxy Error in nova docker installation

When I install nova-docker from github repositories it runs setup.py; from that script some packages are downloaded and installed but after that it raises a ProxyError during the installation. Downloading unittest2-1.0.1-py2.py3-none-any.whl (95kB): 95kB downloaded Downloading/unpacking linecache2 (from traceback2->testtools>=0.9.22->fixtures>=0.3.14->oslo.concurrency>=0.1.0) Cleaning up… Exception: Traceback (most recent call last): File “/usr/lib/python2.7/site-packages/pip/basecommand.py”, line 122, in main status = self.run(options, […]

Problems with Python3.4 in Docker

I’m trying to set up Python3.4 in a Docker image and it is driving me mental. I’ve been having this problem, when I try to install a python module using pip I get this error in terminal: SystemError: Cannot compile ‘Python.h’. Perhaps you need to install python-dev|python-devel. _configtest.o: In function `main’: /tmp/easy_install-wd8wc868/numpy-1.10.0.post2/_configtest.c:6: undefined reference to […]

copy file from docker to host system using python script

I have logged into the docker from the below command, now from the python script i want to copy the file from docker to host system how to do this sudo docker run -ti video:new /bin/bash import os os.system(‘cp /tmp/a.txt HOST:/tmp/a.txt’)

How to Update pip in docker using fig?

It seems like the pip in docker is old: Traceback (most recent call last): File “/usr/bin/pip”, line 9, in <module> load_entry_point(‘pip==1.5.4’, ‘console_scripts’, ‘pip’)() File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 351, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 2363, in load_entry_point return ep.load() File “/usr/lib/python2.7/dist-packages/pkg_resources.py”, line 2088, in load entry = __import__(self.module_name, globals(),globals(), [‘__name__’]) File “/usr/lib/python2.7/dist-packages/pip/__init__.py”, line 11, […]

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