The new "Star Wars
Q:
Doubly Linked
{
"id": "afb8b
The effects of met
In the current stu
Q:
How to read a
Effect of water st
This disclosure re
Nike Air Jordan 6
NO. 07-05-0441-CRQ:
Get error while building a project in a docker container on windows 10
I'm trying to use boot2docker on windows 10.
I create a docker container as a standard user and try to build a python 3.5 django project in the container (with pipenv). I also created an ssh-key from my local computer. When I run my container with bash as a user, pip install packages successfully and I get a success message from pipenv. However, if I use powershell as the user, then pipenv fails to get packages. The errors I get are not very informative:
Collecting Pillow==5.3.0 (from -r /tmp/requirements.txt (line 5))
Downloading https://files.pythonhosted.org/packages/67/5f/b631b4c36a0cdca47d35cdf7b8ad6bba4e30a2a5cbb55daaeea1f6a0e6aa/Pillow-5.3.0-cp35-cp35m-win_amd64.whl (3.8MB)
Collecting pyflakes; extra == "all" (from -r /tmp/requirements.txt (line 6))
Downloading https://files.pythonhosted.org/packages/6c/6b/ffb2b9bfb27b8ccf3cab69a4438cabf4d4facbdb9f7f939e7c6ef8c4aadb/pyflakes-1.5.0-py2.py3-none-any.whl (33kB)
Collecting bleach==1.5.0 (from -r /tmp/requirements.txt (line 7))
Downloading https://files.pythonhosted.org/packages/fa/b9/2e9afdcb8e5ad9d1dcdb4df64e2be6bd5fb13e3838bfabeb0aebfaf7e8f0/bleach-1.5.0-py2.py3-none-any.whl
Collecting python3-openid==3.1.0 (from -r /tmp/requirements.txt (line 9))
Downloading https://files.pythonhosted.org/packages/3c/d5/9dfbcb69f3dd1d8bba2e4a6eb0b6a3eec3b6cc73664a6450bb1f4a22f6db/python3-openid-3.1.0-py3-none-any.whl
Collecting six==1.11.0 (from -r /tmp/requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/5f/26/5b9a57c85ee0e2d15b9b9d6b44eebeb89b2ecfcc6cfc9df7b77c17ecb1af/six-1.11.0-py2.py3-none-any.whl
Collecting importlib_metadata==0.8 (from -r /tmp/requirements.txt (line 11))
Downloading https://files.pythonhosted.org/packages/b4/07/01bfd1ef4ce4b8f2330f3be8faf7a4b5afdd1b1bf9ce3b5b2d9c5f09dc8d/importlib_metadata-0.8.tar.gz (46kB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "c:\python35\lib\tokenize.py", line 442, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'lib2to3\pgen2\__init__.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\python35\lib\tokenize.py
Exception:
Traceback (most recent call last):
File "c:\python35\lib\site-packages\pip\_internal\cli\base_command.py", line 153, in _main
status = self.run(options, args)
File "c:\python35\lib\site-packages\pip\_internal\cli\base_command.py", line 140, in run
raise CommandError('pip failed with error code %s' % exit_code)
File "c:\python35\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in _run
File "c:\python35\lib\site-packages\pip\_internal\cli\autocompletion.py", line 11, in shell
File "c:\python35\lib\site-packages\pip\_internal\cli\autocompletion.py", line 27, in get_completions
File "c:\python35\lib\site-packages\pip\_internal\utils\misc.py", line 81, in open_zip
File "c:\python35\lib\tempfile.py", line 748, in __exit__
self.remove()
File "c:\python35\lib\tempfile.py", line 477, in remove
if not self.closed:
File "c:\python35\lib\tempfile.py", line 366, in __del__
File "c:\python35\lib\tempfile.py", line 380, in _tempfile
self.name, self.fd)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\johndoe\\.virtualenvs\\browsertesting\\lib2to3\\pgen2\\__init__.py'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\python35\lib\runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "c:\python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\johndoe\virtualenvs\browsertesting\lib\site-packages\pip\__init__.py", line 11, in
__import__('pkg_resources').run_script(script_name, namespace)
File "c:\python35\lib\site-packages\pip\_internal\__init__.py", line 27, in run_script
"name: %s" % (cmd_name, cmd[0])
NameError: name 'cmd_name' is not defined
Dockerfile:
FROM python:3.5.3-onbuild
ADD . /usr/src/app
WORKDIR /usr/src/app
RUN pip install -r requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt
ENTRYPOINT ["python", "manage.py", "runserver"]
CMD []
Is there anything that I should change in the Dockerfile? Or is this a problem with boot2docker?
A:
You might have to ensure you are starting your containers with command= instead of starting with bash:
docker run -itd --rm -p 3000:3000 --name some-php-demo -v "$PWD":/usr/src/app pypa/virtualenv /bin/bash -c "pip install -r requirements.txt && docker-php-ext-enable pdo_pgsql && ./usr/src/app/manage.py runserver 0.0.0.0:8000"
The /bin/bash -c "commands" need to be quoted as otherwise the shell will expand bash -c
Also you will have to set up your httpd to listen on port 80 (by default Apache is listening to 8080)