You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /project
WORKDIR /project
ADD requirements.txt /project/
RUN pip install -r requirements.txt
ADD testapp /project/
RUN /project/manage.py migrate
CMD ["python3", "/project/manage.py", "runserver", "0.0.0.0:8000"]
SUMMARY
The import command fails when the Dockerfile contains the ADD command pointing to a directory.
WORKAROUND
Replacing ADD with COPY resolves the issue.
STEPS TO REPRODUCE
Save the Dockerfile into a new directory
Inside that directory create another one named "testapp"
Run ansible-container import .
EXPECTED RESULTS
Project correctly imported to ansible-container.
ACTUAL RESULTS
$ ansible-container import .
ERROR Unknown exception
Traceback (most recent call last):
File "/home/.../lib/python3.5/site-packages/container/cli.py", line 268, in __call__
getattr(core, u'hostcmd_{}'.format(args.subcommand))(**vars(args))
File "/home/.../lib/python3.5/site-packages/container/__init__.py", line 28, in __wrapped__
return fn(*args, **kwargs)
File "/home/.../lib/python3.5/site-packages/container/core.py", line 425, in hostcmd_import
engine_obj.import_project(base_path, **kwargs)
File "/home/.../lib/python3.5/site-packages/container/__init__.py", line 28, in __wrapped__
return fn(*args, **kwargs)
File "/home/.../lib/python3.5/site-packages/container/docker/engine.py", line 769, in import_project
dfi.run()
File "/home/.../lib/python3.5/site-packages/container/docker/importer.py", line 489, in run
(list(parser), os.path.join(self.role_path, 'tasks', 'main.yml')),
File "/home/.../lib/python3.5/site-packages/container/docker/importer.py", line 187, in __iter__
comments=preparsed.get('comments', [])):
File "/home/.../lib/python3.5/site-packages/container/docker/importer.py", line 40, in __wrapped__
to_return = fn(self, payload, comments, **kwargs)
File "/home/.../lib/python3.5/site-packages/container/docker/importer.py", line 347, in parse_ADD
_ = tarfile.open(real_path, mode='r:*')
File "/home/.../lib/python3.5/tarfile.py", line 1559, in open
return func(name, "r", fileobj, **kwargs)
File "/home/.../lib/python3.5/tarfile.py", line 1657, in bz2open
compresslevel=compresslevel)
File "/home/.../python3.5/lib/python3.5/bz2.py", line 95, in __init__
self._fp = _builtin_open(filename, mode)
IsADirectoryError: [Errno 21] Is a directory: './testapp'
Dockerfile
SUMMARY
The import command fails when the Dockerfile contains the ADD command pointing to a directory.
WORKAROUND
Replacing ADD with COPY resolves the issue.
STEPS TO REPRODUCE
ansible-container import .
EXPECTED RESULTS
Project correctly imported to ansible-container.
ACTUAL RESULTS
OS / ENVIRONMENT
The text was updated successfully, but these errors were encountered: