Reputation: 9
I have a project to do some network tests using pyats xpresso
dashboard pyats xpresso
and I use Docker image ciscotestautomation/pyats
to do the test which has Dockerfile:
Dockerfile for creating pyats-docker
And an entrypoint.sh file contains: pyats docker-entrypoint.sh
the problem is: I created a volume in the ubuntu docker host to upload some test files to the docker container "pyats".
and I got the following Error Details:
"Run upload failed - upload failed because zip_path was not found."
and the run console log is:
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
/entrypoint.sh: line 11: /pyats/bin/activate: No such file or directory
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
/entrypoint.sh: line 11: /pyats/bin/activate: No such file or directory
/entrypoint.sh: line 11: /pyats/bin/activate: No such file or directory
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
how to solve the issue, I am a newbie to docker and pyats xpresso as well. and I think the issue is in docker volume if I am not wrong.
Upvotes: 0
Views: 105
Reputation: 131
As you can see in the Dockerfile, when the docker image was created, Python3 virtualenv
have been initialized in /pyats
directory inside your docker image. This directory contains some folders and files.
When you create and attach a new volume to /pyats
, all files and folders installed in /pyats
directory inside your docker image by the Dockerfile
will be override with the contents of your new volume. This is why you get:
/entrypoint.sh: line 11: /pyats/bin/activate: No such file or directory
In order to make it running, you may run your docker image without attaching any volume to /pyats
.
But if you still need to have persistent files in /pyats
while being able to modify it from your host, you may attach your volume to a new folder inside /pyats
like this:
Create your host file directory and put your files in it:
mkdir myfiledir
echo "print('hello there!')" > myfiledir/testfile.py
Mount your host file directory to /pyats/myfiles
inside your docker container and you may access your files:
docker run -it -v $(pwd)/myfiledir:/pyats/myfiles ciscotestautomation/pyats:latest
[Entrypoint] Starting pyATS Docker Image ...
[Entrypoint] Workspace Directory: /pyats
[Entrypoint] Activating workspace
Python 3.6.14 (default, Jun 29 2021, 21:29:56)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exec(open("myfiles/testfile.py").read())
hello there!
>>> exit()
Please note that you may change myfiles
to other folder name as you like but not bin
, lib
or users
because those directories already exits in /pyats
ls -l /pyats
total 16
drwxr-xr-x 3 root root 4096 Jul 29 14:42 bin
drwxr-xr-x 3 root root 4096 Jul 29 14:42 lib
-rw-r--r-- 1 root root 225 Jul 29 14:42 pyvenv.cfg
drwxrwxr-x 2 root root 4096 Jul 29 14:43 users
Upvotes: 0