Tag: python 3.x

Docker远程API在创build容器上返回500错误

我正在使用Python请求库将docker命令发送到远程服务器。 我无法创build一个新的容器。 POST命令是否需要某些参数(数据字段)? 服务器总是返回一个500错误。 我的要求是这样的。 r1 = requests.post(“ http://xxx.xxx.xx.xx:4243 / containers / create?name = pycount ”) 我尝试过使用和不使用名称,主机名,更大的数据字段(来自其他示例)。 服务器总是返回500。 谢谢!

docker分割错误(core dump),在这种情况下该怎么办?

root@ramcharran-VirtualBox:/home/ramcharran/src# docker run -it dll_img /bin/bash bash-4.3# python3 app.py connection to cursor registering tokenizer virtual table created inserted data into virtual table Segmentation fault (core dumped) bash-4.3# 我已经尝试增加ulimit -c无限的核心限制,没有工作。 我已经在本地成功地执行了代码,但是用docker,我似乎得到了一个我不明白的分段错误。 我试图增加没有工作的basedevice存储。 我的docker机由于某种原因没有basedevice存储。 root@ramcharran-VirtualBox:/home/ramcharran# docker info Containers: 6 Running: 0 Paused: 0 Stopped: 6 Images: 19 Server Version: 1.12.3 **Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing […]

为什么使用Docker的Django服务器在postgresql中没有数据库运行?

我想知道为什么我的服务器正在运行,为什么没有看到另一个数据库。 用psql和\l : List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ————-+————-+———-+————-+————-+———————– aso | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | […]

为什么docker-compose使用〜60GB来构build这个图像

当我开始docker-compose build我有60演出免费。 完成之前,我的空间用完了。 任何想法可能会发生什么? 我正在运行最新的Docker for Mac和docker-compose 这里是我的docker-compose文件: version: '3' services: db: image: postgres:9.6-alpine volumes: – data:/var/lib/postgresql/data ports: – 5432:5432 web: image: python:3.6-alpine command: ./waitforit.sh solr:8983 db:5432 — bash -c "./init.sh" build: . env_file: ./.env volumes: – .:/sark – solrcores:/solr ports: – 8000:8000 links: – db – solr restart: always solr: image: solr:6-alpine ports: – […]

无法在Docker中安装nltk

我想在docker上安装nltk包,下面是我的docker文件 FROM python:3-onbuild # COPY startup script into known file location in container COPY start.sh /start.sh RUN python -m libs.py # EXPOSE port 8000 to allow communication to/from server EXPOSE 8000 # CMD specifcies the command to execute to start the server running. CMD ["/start.sh"] # done! libs.py包含nltk包,在requirements.txt中安装了nltk == 3.2.5 import nltk nltk.data.path('libs/') nltk.download('wordnet') nltk.download('pros_cons') […]

不能在Docker中安装libpulse-dev

我目前正在试图build立一个docker集装箱,并安装在一些图书馆,我将用于机器学习。 这是我的Dockerfile: FROM python:3.6-alpine ENV PATH :$PATH ADD . /app WORKDIR /app #Install dependencies RUN echo "===> Installing sudo to emulate normal OS behavior…" RUN apk –update add sudo RUN apk –update add libxml2-dev libxslt-dev RUN apk –update add python py-pip openssl ca-certificates RUN apk –update add –virtual build-dependencies python3-dev libffi- dev openssl-dev build-base gfortran […]

Python远程debugging器不会在VS代码中debugging我的代码

我正在Docker容器里面运行Python 3.6的应用程序。 我试图从我的Mac上的VS Codedebugging烧瓶应用程序。 我已经附加了远程debugging器,虽然我的断点没有被击中,并且在VS Code中都显示为“未validation”的断点。 当我运行远程debugging器时,它在Resource.dispatchRequest()中的flask的__init__.py第587行中断开,它读取resp = meth(*args, **kwargs) 。 试图向前迈进,迈进或迈出不成果。 继续打多次(大约20次)将从我的testing脚本继续下一个请求。 debugging器从来没有停止在我的代码中的断点,它显示我的断点作为未经validation的断点。 当debugging器停留在烧瓶请求代码中时,调用堆栈将以灰色显示我的代码中的方法,并在其旁边显示“未知源”。 我无法在调用堆栈中进入它们,尽pipe我可以在“variables”窗口中看到局部variables。 我怎样才能得到VS代码来debugging我的代码?

如何将Emacs的Elpy in-buffer python解释器连接到docker容器?

我正在开始一个将在Docker容器中运行的Django应用程序。 我希望能够在Emacs中使用交互式Python ,在Docker容器和Django应用程序的上下文中执行代码。 基本上我想要Emacs使用的Python解释器在Docker容器中运行。 我已经设法达到这一点,大部分是通过创build一个修改的Dockerfile,它只是不同于我的实际Dockerfile容器,而不是调用它结束的Django命令: CMD ./manage.py shell 这意味着当我运行该Docker容器时,我得到了一个实际在容器中运行的Django解释器。 我有Elpy调用这个时启动一个python shell通过添加: (setq python-shell-interpreter "/path_to_my_script/run_shell.sh") 到我的.emacs.d / init.el文件。 其中“/path_to_my_script/run_shell.sh”脚本是运行容器的脚本。 这实际上是大部分工作。 我可以突出显示一行代码,如 from django.utils import timezone 并运行Emacs命令elpy-shell-send-region-or-buffer并执行代码。 我可以突出显示 print(timezone.now()) 它会打印当前时间。 我已经validation,这个代码实际上是运行在我的容器上运行: import os print(os.getcwd()) 并看到我的Docker容器的用户的主目录。 我仍然使用这个设置的问题是当我尝试使用相同的elpy-shell-send-region-or-buffer命令同时执行多行python时。 当我突出显示多行并执行该命令时,在python shell中出现以下错误: Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python3.5/codecs.py", line 895, in open file = […]

Django与Heroku上的Postgresql – 无法将主机名“db”翻译为地址:名称或服务未知

我部署在Heroku我的项目在Docker与Angular 4前端,Django后端和Postgresql数据库。 在这个时候我的文件看起来如下所示。 当我打开应用程序,我得到错误: 2017-07-11T19:51:14.485577+00:00 app[web.1]: self.connect() 2017-07-11T19:51:14.485577+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/db/utils.py", line 94, in __exit__ 2017-07-11T19:51:14.485578+00:00 app[web.1]: six.reraise(dj_exc_type, dj_exc_value, traceback) 2017-07-11T19:51:14.485578+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise 2017-07-11T19:51:14.485578+00:00 app[web.1]: raise value.with_traceback(tb) 2017-07-11T19:51:14.485579+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection 2017-07-11T19:51:14.485579+00:00 app[web.1]: self.connect() 2017-07-11T19:51:14.485579+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/base/base.py", line 189, in connect 2017-07-11T19:51:14.485580+00:00 app[web.1]: self.connection = […]

在dockerfile中cachingPIP包

我正在尝试为我的python项目设置docker,该项目使用虚拟环境,并在requirements.txt定义了一些依赖关系。 我也设置了Dockerfile docker-compose ,它使用Dockerfile来使用命令build立我的项目图像Dockerfile docker-compose up –build 我的Dockerfile: FROM ubuntu:16.04 FROM python:3.5 MAINTAINER **** ADD . /core-proejct WORKDIR /core-project RUN pip3 install virtualenv RUN . /bin/activate RUN pip install -r requirements.txt 所以,每当我尝试构build映像时,它都会从requirements.txt安装所有的pip模块。 无论如何,我可以cachingpip模块,并在构build映像时使用caching版本。