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

Net Use fails on Windows Nano Container to Azure File Share #1306

Closed
mrwalters1988 opened this Issue Nov 9, 2017 · 12 comments

Comments

Projects
None yet
7 participants
@mrwalters1988
Copy link

mrwalters1988 commented Nov 9, 2017

Expected behavior

Net Use maps a drive to Azure File Share. I can't include the exact file share for security reasons, but I've provided as much as I can for it to be easily replicable.

Actual behavior

PS C:> cmdkey /add:\MyFileShareName.file.core.windows.net /user:Username /pass:KeyInfo
CMDKEY: Credential added successfully.
PS C:> net use K: \MyFileShareName.file.core.windows.net\MyFileShare /u:Username KeyInfo
System error 1783 has occurred.
The stub received bad data.

The above error does not occur on the host (Host can reach share fine) but does occur on the container, both when running via dockerfile and when connecting to a container and running manually.

Information

DockerFile Contents:
FROM microsoft/nanoserver:10.0.14393.1770 as RedpointInstall
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN powershell cmdkey /add:\MyFileShareName.file.core.windows.net /user:Username /pass:KeyInfo
RUN powershell net use K: \MyFileShareName.file.core.windows.net\MyFileShare /u:Username KeyInfo
ENTRYPOINT powershell.exe

PS C:\DeployFiles> docker version
Client:
Version: 17.06.1-ee-2
API version: 1.30
Go version: go1.8.3
Git commit: 8e43158
Built: Wed Aug 23 21:16:53 2017
OS/Arch: windows/amd64

Server:
Version: 17.06.1-ee-2
API version: 1.30 (minimum version 1.24)
Go version: go1.8.3
Git commit: 8e43158
Built: Wed Aug 23 21:25:53 2017
OS/Arch: windows/amd64
Experimental: false

Steps to reproduce the behavior

  1. Run dockerfile
  2. See error

Alternatively:

  1. Create Nano Container
  2. Connect to Container
  3. net use map an Azure file share.
@mrwalters1988

This comment has been minimized.

Copy link

mrwalters1988 commented Nov 10, 2017

1709 has been awash in issues each time I've attempted using it. For instance, when uploading a powershell script to run, it fails on running itself. So, haven't gotten far enough in 1709 to even attempt a persistent drive on it. (Omitted irrelevant results)

Step 8/10 : RUN powershell dir
---> Running in 6a22cd3527ec
container 6a22cd3527ec1778a3888d37d11e5649b68dbff2ce9419043c760a2d73e43e6b encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"ApplicationName":"","CommandLine":"powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; powershell dir","User":"ContainerUser","WorkingDirectory":"C:\","Environment":{},"EmulateConsole":false,"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}

@friism

This comment has been minimized.

@mrwalters1988

This comment has been minimized.

Copy link

mrwalters1988 commented Nov 10, 2017

So 1709 nanoserver run commands all have to be CMD?

@mrwalters1988

This comment has been minimized.

Copy link

mrwalters1988 commented Nov 10, 2017

Does Nano 1709 also not contain a registry?

Step 15/16 : RUN reg.exe import C:\merged.reg
---> Running in fc87fbc0b149
ERROR: Error accessing the registry.

@friism

This comment has been minimized.

Copy link

friism commented Nov 10, 2017

Here's an example of building 1709 nanoserver based images: https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/nanoserver-1709/amd64/Dockerfile

You can also get nanoserver 1709 images with PowerShell installed: https://hub.docker.com/r/microsoft/powershell/tags/

I haven't seen the error you're getting, maybe it's related to the user account: https://github.com/StefanScherer/dockerfiles-windows/blob/master/portainer/Dockerfile.1709#L6

cc @StefanScherer

@StefanScherer

This comment has been minimized.

Copy link

StefanScherer commented Nov 10, 2017

Modifying registry you probably need USER ContainerAdministrator instruction in your Dockerfile. Nanoserver 1709 uses ContainerUser by default.

@mrwalters1988

This comment has been minimized.

Copy link

mrwalters1988 commented Nov 13, 2017

Thanks guys. That did work out, but for whatever reason 1709 nano won't run my app. I'll give 1709 core a try and see if that'll handle the persistent storage mapping I need.

@codesynergy

This comment has been minimized.

Copy link

codesynergy commented Nov 16, 2017

A colleague and I recently ran into the same error with the “net use” command (System error 1783 has occurred. The stub received bad data.) with the WindowsServerCore image. Actually, any command we used to try and establish a connection to an internal network share would fail (i.e., equivalent powershell commands to “net use”).

On some machines/configurations it was working, on some it was not. After testing many permutations, we came to the conclusion it was due to this windows update: [https://support.microsoft.com/en-us/help/4041691/windows-10-update-kb4041691]

However, it appears one of the latest Windows updates resolves this issue. After applying all windows updates on the host machine, along with updating to the latest Microsoft/WindowsServerCore image, the issue is no longer occurring. It must be one of the following updates that fixes the issue:

image

Some additional information that might help:
• The host machine is Server 2016 Standard, Version 1607, Build 14393.1884. It is a VMWare VM.
• Docker 17.09.0-ce-win33 (13620) installed
• The host machine is attached to a domain.
• Running the Microsoft/WindowsServerCore image.
• Trying to use “net use” to connect to a file share on the same domain as the host.

It appears the solution is to:

  1. Apply all available Windows updates.
  2. Use the latest Microsoft/WindowsServerCore image.
  3. Rebuild any custom images that are based off of the WindowsServerCore image. I’m not sure if this is 100% related, but we ran into issues if we did not rebuild our images after doing the first two steps.
@codesynergy

This comment has been minimized.

Copy link

codesynergy commented Nov 20, 2017

Adding some more info...

It appears the "net use" command works with the new WindowsServerCore image on a host with the update that broke "net use" with the older WindowsServerCore image. It other words, it appears updating the image is enough to fix the issue.

@tfrijsewijk

This comment has been minimized.

Copy link

tfrijsewijk commented Dec 13, 2017

We had the exact same issue. I was able to fix this by only updating the host. Some weren't updated in 2-3 months

@docker-desktop-robot

This comment has been minimized.

Copy link
Collaborator

docker-desktop-robot commented Mar 28, 2018

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment