Tag: python 2.7

put_archive与python马拉松docker应用程序?

我猜想,我想要做的是不可能的devise,但certificate我错了。 对于我们的一个后端,我们使用python marathon客户端来pipe理mesos群集上的docker容器。 我想要做的是一旦它启动,dynamic添加一个文件到docker容器。 使用普通的docker客户端,我会做这样的事情: def create_archive(file_contents, file_name): """ doc """ tarstream = io.BytesIO() with tarfile.open(fileobj=tarstream, mode='w') as tarfile_: encoded_file_contents = file_contents.encode('utf8') tarinfo = tarfile.TarInfo(file_name) tarinfo.size = len(encoded_file_contents) tarinfo.mtime = time.time() tarfile_.addfile(tarinfo, io.BytesIO(encoded_file_contents)) logger.info("[+] Successfully created tarfile {}".format(file_name)) # We're at the end of the tarstream, go back to the beginning. return tarstream.seek(0) def add_docker_archive(docker_client, […]

dockerize错误不是目录

以下命令在OSX上给出错误。 任何想法,为什么这是行不通的? 蝙蝠侠:demo davinci $ dockerize -t demo –cmd / demo –add-file /Users/davinci/src/demo/.build/demo / demo Traceback(最近调用最后一个):在load_entry_point('dockerize == 0.2.2','console_scripts','dockerize')()中,第11行的文件“/ usr / local / bin / dockerize” 文件“/usr/local/lib/python2.7/site-packages/dockerize/main.py”,行125,在主app.build() 文件“/usr/local/lib/python2.7/site-packages/dockerize/dockerize.py”,第122行,在build self.resolve_deps() 文件“/usr/local/lib/python2.7/site-packages/dockerize/dockerize.py”,第200行,位于resolve_deps deps.add(path) 文件“/usr/local/lib/python2.7/site-packages/dockerize/depsolver.py”,第110行,添加self.get_deps(path) 文件“/usr/local/lib/python2.7/site-packages/dockerize/depsolver.py”,第81行,在get_deps elf = ELFFile(path) 文件“/usr/local/lib/python2.7/site-packages/dockerize/depsolver.py”,第36行,在init self.read_sections() 文件“/usr/local/lib/python2.7/site-packages/dockerize/depsolver.py”,第42行,在read_sections中stderr = subprocess.STDOUT) 文件“/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”,第212行,在check_output process = Popen(stdout = PIPE,* popenargs,** kwargs) 文件“/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”,390行,在初始化 errread,错误) 文件“/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py”,1024行,在_execute_child中raise child_exception OSError:[Errno 20]不是目录

在MXnet中使用im2rec来创build带有png图像的数据集

我正在尝试按照这里的例子,并创build自己的数据集使用MXnet的培训。 我的数据按照示例中的规定进行组织: /data yes/ file1.png file2.png … no/ file1.png file2.png … 本教程说明了第一步是运行im2rec.py来创build.lst文件,然后再次运行im2rec.py (不同的选项)来创build.rec文件。 要创build.lst文件,我input: > python tools/im2rec.py my_data /data –list True –recursive True –train-ratio .75 –exts .png 完成后,将创build两个文件(按预期), my_data_train.lst和my_data_val.lst 。 这两个文件中的总行数与我的yes/和no/目录中的文件总数相同。 然后,我尝试再次运行im2rec以使用以下命令创build.rec文件: > python tools/im2rec.py my_data /data –resize 227 –num-thread 16 这会运行几秒钟,然后(默默)崩溃。 在这个过程中,它创build了4个空文件: my_data_train.idx , my_data_train.rec , my_data_val.idx和my_data_val.rec 。 问题:为了能够创build一个包含我自己的.png图像的正确的.rec文件,我需要做些什么改变? 额外详情: 我正在docker hub上由dmlc提供的docker容器(mxnet / python:gpu)中工作; […]

docker-py将networking模式设置为主机

我有docker泊坞窗Docker version 1.10.3, build 20f81dd和客户端docker-py==1.9.0 。 我希望能够通过python客户端设置–net=host ( –net=host )或net: host (docker-compose)设置,但文档说network_mode is available since v1.11 。 我如何通过python客户端来模拟这种行为?

Google API API凭据存储不能与docker一起使用

我正在尝试构build一个Flask应用程序来执行某种Google表单操作。 我的应用程序完全按照预期在localhost [ python app.py ]中运行。 但是,当我build立一个Docker容器然后运行时,执行卡在凭证存储指令中。 credentials = tools.run_flow(flow, storage=store, flags) 我正在关注这个文档 。 我的get_credentials()如下 def get_credentials(): home_dir = os.getcwd() credential_dir = os.path.join(home_dir, 'credentials') if not os.path.exists(credential_dir): os.makedirs(credential_dir) credential_path = os.path.join(credential_dir, 'api_credentials.json') store = Storage(credential_path) credentials = store.get() if not credentials or credentials.invalid: flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES) flow.user_agent = APPLICATION_NAME if flags: credentials = tools.run_flow(flow, […]

在Windows上安装python 2.7的Docker的Jupyterterminal上安装matplotlib时出错

我有一个问题,试图在Docker上安装matplotlib库,我已经安装了python 2.7与Anaconda 2框架。 而且我还安装了Docker,以便为Python使用QuantLib库, 这样做后,我当时正在使用jupyter来使用Docker,我注意到在我的笔记本中编码时无法导入matplotlib,所以为了安装它,我已经在jupyter中打开了一个terminal并尝试了命令: pip install matplotlib 但是,然后,我有以下错误信息: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-irkomQ/matplotlib/ 当遇到同样的问题时,他们在Ubuntu或Debian上使用了一些命令,但是它不适用于Docker的Jupyterterminal。 如果你使用Docker,你知道如何克服这个错误,并通过jupyterterminal安装matplotlib? PS:我的所有命令都以pipe理员权限(#)input 非常感谢你!

使用docker从串口读取数据

我有一个python代码(ard_temp.py),它使用pyserial库从USB串口读取数据,然后使用散景显示在端口50010中。 它适用于寡妇和Mac。 任何想法如何dockerize它? 我做了一个Dockerfile如下: # Use an official Python runtime as a parent image FROM continuumio/anaconda # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app ADD . /app # Install any needed packages specified in requirements.txt RUN conda install pyserial RUN conda install bokeh […]

如何从docker集装箱内使用jupyter笔记本?

我知道有基本的图像来处理这个,但我的docker图像需要包括在下面的Dockerfile中的一切: FROM debian:8.5 MAINTAINER Kamil Kwiek <kamil.kwiek@continuum.io> ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 RUN apt-get update -yqq –fix-missing && apt-get install -yqq wget bzip2 ca-certificates \ libglib2.0-0 libxext6 libsm6 libxrender1 \ git mercurial subversion RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ wget –quiet https://repo.continuum.io/archive/Anaconda2-4.4.0-Linux-x86_64.sh -O ~/anaconda.sh && \ /bin/bash ~/anaconda.sh -b -p /opt/conda && \ rm ~/anaconda.sh […]

如何获得docker容器的内容(Python / Pandas)

我正在尝试创build一个简单的Dockerfile ,在其中创build一个pandas数据框并将其写入一个csv。 csv保存在docker容器中,我想把它提取到我的本地目录。 当我尝试使用docker cp获取内容时,它说没有这样的容器。 这是我的docker文件: # User an official Python runtime as a parent image FROM python:2.7-slim # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app ADD . /app RUN pip install -r requirements.txt RUN mkdir -p results CMD ["python", "app.py"] 这里是我的Python代码: import […]

我想知道如何在任何本地IDE中运行员工欢乐开源项目

我已经从GitHub https://github.com/Staffjoy/suite下载了项目工作人员的喜悦,并且阅读了要求,并在Windows操作系统中安装了redis和mysql,并在Visual Studio环境中集成了该项目,并安装了python 2.7并安装所有的库和不能运行的项目如果我运行在Mac中使用shell命令的项目,如果我运行make dev它会自动下载行os和安装python和所有的依赖项,并运行应用程序,但我无法运行在窗户为什么? 而且我也想要项目中使用的技术,请解释他们为什么使用stream浪汉和虚拟框