-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invalid volume specification #461
Comments
I'm experiencing the same when trying to run aws-sam-cli in my docker image:
|
i'm seeing the same issue as @uvaisTrivecta |
Same issue here with the following installed on Windows 10 Pro Version 1803 Build 17134.112. I used the sample project created by sam init. I've also tried getting it to work with the new Docker for Windows, but without documentation I haven't figured how to get it talking to docker-machine. Any help/workaround would be much appreciated.
Stack trace:
|
@DanielLaberge and I were able to get his install working. Here are some steps that should hopefully help get over this problem.
I believe this is a docker installation problem and not with the cli (given what @DanielLaberge and I did). I am going to leave this open for a little while though. |
Just to clarify: I deleted the following items left behind by docker-toolbox:
Thanks again @jfuss. |
@jfuss @DanielLaberge Docker for windows is available only for Windows 10 Pro, the issue which i face is with Windows8.1 Pro. So u mean that aws-sam-cli can only be worked with Windows10 since docker for windows is available for the same? If not kindly help us with some solutions ... |
@jfuss thanks for your help in investigating this. so just to be explicit, is the following correct?
|
@uvaisTrivecta and @jsantoru Where does it state we don't support anything but Windows 10? If this is in response to my comment above, those are the sets we tool to get it working for @DanielLaberge. If able, I encourage everyone to update to Docker for windows. @uvaisTrivecta and @jsantoru Are you guys able to run |
@jfuss according to the docker site: https://store.docker.com/editions/community/docker-ce-desktop-windows
so if the solution is to use i might be missing something, but that's my understanding to this point |
@jsantoru As your comment says: "For previous versions get Docker Toolbox." |
@jfuss this first line still applies though doesn't it?
|
@uvaisTrivecta From your error message above I see: Why are you mounting the non-generated cookiecutter project? Don't do this! This is for generating the sam app from We had some issue with .jars not mounting correctly. This could be the same thing. Could you try and update to v0.4.0? My hunch is it is a mix of both issues. |
@jsantoru You are looking way to deep into this. What that means is if you are using Windows 10 Professional or Enterprise 64-bit, use docker for windows. If that does not apply to you use docker toolkit. Put very clearly: Yes we support docker toolkit but use docker for windows if you can. |
@drissamri It looks like you were also using a jar. Can you upgrade to v0.4.0 and see if you get the same mount issue. We fixed an issue related to .jar that I think it causing this issue. @jsantoru For the functions that cause the 'invalid volume specification`, what does your CodeUri look like? Is it a zip or jar? |
@jfuss it's a jar, so I'll upgrade to v0.4.0 and see if that resolves it. thanks again for helping out with this, much appreciated. |
@jsantoru Please let me know if that ended up working for you. |
@jfuss Many Thanks for looking in to this.
|
@uvaisTrivecta What does your CodeUri in your template look like? Did you generate your own project or still using |
@jfuss tried with my own project only and also cookiecutter.project_name. Error log : (Sharing the log again) sam-cli version 0.4.0 E:\Aws Lambda\aws-serverless-java-container\samples\spring\pet-store>sam local start-api --template sam.yaml Fetching lambci/lambda:java8 Docker container image...... |
@jfuss I've upgraded to 0.4.0 but it's still not working. I'm running on OSX and locally it works perfectly on 0.3.0 and 0.4.0, but when I try to run it inside a docker image (for easier automated testing with sam local) it keeps on failing. |
This issue is particular to setups using Docker Toolbox on Windows, which is the only option for people running a version of Windows < 10 Pro. It appears to be caused by
The calls to As an example, Note that this path conversion happens within This issue effectively makes |
@bryanburke Thanks for the detailed response. I didn't have data to suggest it wasn't a docker issue before and didn't understand the differences between Docker Toolbox and Docker for Windows (hence the I believe in my pervious statement and why I left this issue open). Do you by chance know, if unix-style paths are accepted in Docker For Windows? Not a big deal if you don't, this is a pretty easy thing we can validate. Updating labels. |
@jfuss Thank you for labeling this issue as critical. Regarding paths Docker for Windows can accept, according to the Docker documentation:
I was thinking about possible solutions to this issue. One approach might be the following:
The above approach might also accommodate setups in which Docker for Windows/Docker Toolbox is acting as a client to a remote non-Windows Docker container host. By default, Docker Toolbox creates a VirtualBox share mapping |
I can confirm that this issue also affects setups in which As a (very hacky) temporary workaround for version 0.4.0 of
# Make sure cwd is an absolute path
# self.cwd = os.path.abspath(self.cwd)
# Next, let us get absolute path of function code.
# Codepath is always relative to current working directory
# If the path is relative, then construct the absolute version
if not os.path.isabs(codeuri):
# codeuri = os.path.normpath(os.path.join(self.cwd, codeuri))
codeuri = "/".join([self.cwd, codeuri])
Explanation:
|
@bryanburke I made the changes as per your command, now I landed in a different issue, Fetching lambci/lambda:java8 Docker container image...... |
@jfuss It looks like the issue @uvaisTrivecta is having likely stems from
Here is my (probably incomplete) guess as to how a possible solution might look:
I think this logic might allow @uvaisTrivecta As a temporary workaround, try the following:
|
@bryanburke many thanks for the response as u said , i tried the temp work around , but still the same issue exists 👎 Yaml File : changed from A screen shot of my directory structure Log : Fetching lambci/lambda:java8 Docker container image...... Fetching lambci/lambda:java8 Docker container image...... |
The same error for me... :( |
argh stuck with same issue. I am on Windows 7. Are there any updates to this? |
Same issue here making us cannot use sam local on Windows 7. Tried bryanburke's local_lambda.py hack and ran into ClassNotFoundException as well :( |
Faced the same issue "invalid volume specification" on Win 7, then I got the following after hacking local-lambda.py. C:\Users{username}\sam-app>sam local start-api --docker-volume-basedir /c/Users/{username}/sam-app Fetching lambci/lambda:python3.6 Docker container image...... |
Make sure your directory on the host machine is shared with docker. Maybe try moving it to |
Changed the shared folder setting, no problem finding the module now. But still got the error "invalid volume specification" once accessing http://127.0.0.1:3000/hello $ sam local start-api --docker-volume-basedir /c/Users/{username}/sam-app Fetching lambci/lambda:python3.6 Docker container image...... During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\python36\lib\site-packages\docker\models\containers.py", line 824, in |
@zuifanzhuce You are mounting a windows path. From your output: |
yes, if you really want to experiment, you can still build sam directly from github develop branch as there's a fix merged in there. |
Closing. Was released with 0.6.1 |
I know this is closed but if anyone still gets this, check your docker is running in linux mode and not windows by right clicking on docker and click "Switch to Linux containers" |
Hi, I am still facing this issue. Also the command docker run hello world is not running after providing docker id. Would appreciate a quick help, as we are encountering this issue from past two weeks. All troubleshooting is done, but still no success :( Appreciate your help! |
Hi, custom-entrypoint.sh #find the current running container #start with the default ENTRYPOINT - CMD Dockerfile docker-compose.yaml |
I follow the steps outlined by @jfuss i.e uninstall docker toolkit and install Docker for windows. |
Im facing the invalid volume specification error when trying to run the sample HelloWorld using sam local . I am running Docker Toolbox on Windows8.1 Pro. Sam Version 0.3.0. Docker version 18.03.0-ce, build 0520e24302
Output : (with out --docker-volume-basedir)
C:\Python27\Lib\site-packages\samcli\local\init\templates\cookiecutter-aws-sam-hello-java{{cookiecutter.project_name}}>sam local start-api
2018-06-06 16:11:24 Mounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET]
2018-06-06 16:11:24 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-06-06 16:11:24 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-06-06 16:11:30 Invoking helloworld.App::handleRequest (java8)
2018-06-06 16:11:30 Found credentials in shared credentials file: ~/.aws/credentials
2018-06-06 16:11:30 Decompressing C:\Python27\Lib\site-packages\samcli\local\init\templates\cookiecutter-aws-sam-hello-java{{cookiecutter.project_name}}\target\HelloWorld-1.0.jar
Fetching lambci/lambda:java8 Docker container image......
2018-06-06 16:11:34 Mounting c:\users\lenovo2\appdata\local\temp\tmp2vg4ry as /var/task:ro inside runtime container
[2018-06-06 16:11:34,845] ERROR in app: Exception on /hello [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "c:\python27\lib\site-packages\samcli\local\apigw\service.py", line 161, in _request_handler
self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream, stderr=self.stderr)
File "c:\python27\lib\site-packages\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
stdout=stdout, stderr=stderr)
File "c:\python27\lib\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
self._container_manager.run(container)
File "c:\python27\lib\site-packages\samcli\local\docker\manager.py", line 61, in run
container.create()
File "c:\python27\lib\site-packages\samcli\local\docker\container.py", line 110, in create
real_container = self.docker_client.containers.create(self._image, **kwargs)
File "c:\python27\lib\site-packages\docker\models\containers.py", line 824, in create
resp = self.client.api.create_container(**create_kwargs)
File "c:\python27\lib\site-packages\docker\api\container.py", line 410, in create_container
return self.create_container_from_config(config, name)
File "c:\python27\lib\site-packages\docker\api\container.py", line 421, in create_container_from_config
return self._result(res, True)
File "c:\python27\lib\site-packages\docker\api\client.py", line 231, in _result
self._raise_for_status(response)
File "c:\python27\lib\site-packages\docker\api\client.py", line 227, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "c:\python27\lib\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'c:\users\lenovo2\appdata\local\temp\tmp2vg4ry:/var/task:ro'")
2018-06-06 16:11:34 127.0.0.1 - - [06/Jun/2018 16:11:34] "GET /hello HTTP/1.1" 502 -
2018-06-06 16:11:35 127.0.0.1 - - [06/Jun/2018 16:11:35] "GET /favicon.ico HTTP/1.1" 403 -
Output : (with --docker-volume-basedir)
C:\Python27\Lib\site-packages\samcli\local\init\templates\cookiecutter-aws-sam-hello-java{{cookiecutter.project_name}}>sam local start-api --docker-volume-basedir \c\Users
2018-06-06 16:15:10 Mounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET]
2018-06-06 16:15:10 You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2018-06-06 16:15:10 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
2018-06-06 16:15:14 Invoking helloworld.App::handleRequest (java8)
2018-06-06 16:15:14 Found credentials in shared credentials file: ~/.aws/credentials
Fetching lambci/lambda:java8 Docker container image......
2018-06-06 16:15:17 Mounting C:\c\Users\target\HelloWorld-1.0.jar as /var/task:ro inside runtime container
[2018-06-06 16:15:18,585] ERROR in app: Exception on /hello [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functionsrule.endpoint
File "c:\python27\lib\site-packages\samcli\local\apigw\service.py", line 161, in _request_handler
self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream, stderr=self.stderr)
File "c:\python27\lib\site-packages\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
stdout=stdout, stderr=stderr)
File "c:\python27\lib\site-packages\samcli\local\lambdafn\runtime.py", line 83, in invoke
self._container_manager.run(container)
File "c:\python27\lib\site-packages\samcli\local\docker\manager.py", line 61, in run
container.create()
File "c:\python27\lib\site-packages\samcli\local\docker\container.py", line 110, in create
real_container = self.docker_client.containers.create(self._image, **kwargs)
File "c:\python27\lib\site-packages\docker\models\containers.py", line 824, in create
resp = self.client.api.create_container(**create_kwargs)
File "c:\python27\lib\site-packages\docker\api\container.py", line 410, in create_container
return self.create_container_from_config(config, name)
File "c:\python27\lib\site-packages\docker\api\container.py", line 421, in create_container_from_config
return self._result(res, True)
File "c:\python27\lib\site-packages\docker\api\client.py", line 231, in _result
self._raise_for_status(response)
File "c:\python27\lib\site-packages\docker\api\client.py", line 227, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "c:\python27\lib\site-packages\docker\errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("invalid volume specification: 'C:\c\Users\target\HelloWorld-1.0.jar:/var/task:ro'")
2018-06-06 16:15:18 127.0.0.1 - - [06/Jun/2018 16:15:18] "GET /hello HTTP/1.1" 502 -
2018-06-06 16:15:18 127.0.0.1 - - [06/Jun/2018 16:15:18] "GET /favicon.ico HTTP/1.1" 403 -
The text was updated successfully, but these errors were encountered: