Reputation: 17530
my dockerfile
FROM microsoft/dotnet:2.0.4-runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
rsync \
&& rm -rf /var/lib/apt/lists/*
RUN set -ex \
&& curl -L -o azcopy.tar.gz https://aka.ms/downloadazcopyprlinux \
&& tar -xf azcopy.tar.gz && rm -f azcopy.tar.gz \
&& ./install.sh && rm -f install.sh \
&& rm -rf azcopy
I am starting the container using dotnet client
var container = await client.Containers.CreateContainerAsync(new CreateContainerParameters
{
Hostname = "",
Domainname = "",
User = "",
AttachStdin = false,
AttachStderr = true,
AttachStdout = true,
Tty = true,
Volumes = ...
Image = ...
Cmd = arguments,
HostConfig = new HostConfig
{
LogConfig = new LogConfig { Type = "json-file" },
AutoRemove = false,
Binds = binds
}
});
equivilent to
docker run -v dataout:/data1/S2B_MSIL2A_20180107T102359_N0206_R065_T33UUB_20180107T121759.SAFE earthml/azcopy azcopy --source /data1/S2B_MSIL2A_20180107T102359_N0206_R065_T33UUB_20180107T121759.SAFE --destination https://eodata.blob.core.windows.net/test --dest-key --recursive
but getting the following exception:
Unhandled Exception: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at Microsoft.WindowsAzure.Storage.AzCopy.Interaction.WriteConsoleAtCursor(String message, Boolean finished)
at Microsoft.WindowsAzure.Storage.AzCopy.AzCopy.OutputNonVerboseTransferStatus(Nullable`1 transferredBytes, Boolean finished)
at Microsoft.WindowsAzure.Storage.AzCopy.AzCopy.ProgressUpdate(TransferStatus status)
at Microsoft.WindowsAzure.Storage.DataMovement.TransferProgressTracker.InvokeProgressHandler()
at Microsoft.WindowsAzure.Storage.DataMovement.TransferProgressTracker.AddProgress(TransferProgressTracker progressTracker)
at Microsoft.WindowsAzure.Storage.DataMovement.TransferCollection`1.AddTransfer(Transfer transfer, Boolean updateProgress)
at Microsoft.WindowsAzure.Storage.DataMovement.TransferManager.GetOrCreateDirectoryTransfer(TransferLocation sourceLocation, TransferLocation destLocation, TransferMethod transferMethod, TransferContext transferContext)
at Microsoft.WindowsAzure.Storage.DataMovement.TransferManager.<UploadDirectoryInternalAsync>d__69.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WindowsAzure.Storage.AzCopy.DirectoryTransferLauncher.<UploadDirectory>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WindowsAzure.Storage.AzCopy.DirectoryTransferLauncher.<ExecuteImplAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WindowsAzure.Storage.AzCopy.TransferLauncherBase.<ExecuteAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.WindowsAzure.Storage.AzCopy.BlobFileTransfer.DoTransfer()
at Microsoft.WindowsAzure.Storage.AzCopy.AzCopy.ExecuteTransfer()
at Microsoft.WindowsAzure.Storage.AzCopy.AzCopy.Execute(String[] args)
at Microsoft.WindowsAzure.Storage.AzCopy.AzCopy.Main(String[] args)
/usr/bin/../lib/azcopy/azcopy: line 10: 15 Aborted dotnet $DIR/bin/azcopy.dll "$@"
I wanted to be clear, i use code to run the container, and the exception is thrown inside the container, in azcopy tool.
From the callstack we learned that azcopy is doing something with the console for progress reporting. Maybe thats not allowed in a docker container. Is there any way maybe to give the create/start container call some arguments that would allow what it is doing.
I ran the command with the CLI which works. I tried both with -it and without. Both works. So i am back at dotnet docker client, what are the correct parameters to simulate what the CLI is doing.
PS C:\Users\pks> docker run -v E8A9547E29F57C223876982D46564150:/data1/S2B_MSIL2A_20180107T102359_N0206_R065_T33UUB_20180107T121759.SAFE earthml/azcopy azcopy --source /data1/S2B_MSIL2A_20180107T102359_N0206_R065_T33UUB_20180107T121759.SAFE --destination ht
tps://eodata.blob.core.windows.net/test --dest-key "" --recursive
[2018/01/31 21:53:59] Transfer summary:
-----------------
Total files transferred: 113
Transfer successfully: 113
Transfer skipped: 0
Transfer failed: 0
Elapsed time: 00.00:00:07
PS C:\Users\pks> docker run -it -v E8A9547E29F57C223876982D46564150:/data1/S2B_MSIL2A_20180107T102359_N0206_R065_T33UUB_20180107T121759.SAFE earthml/azcopy azcopy --source /data1/S2B_MSIL2A_20180107T102359_N0206_R065_T33UUB_20180107T121759.SAFE --destinatio
n https://eodata.blob.core.windows.net/test1 --dest-key "" --recursive
Finished 113 of total 113 file(s).
[2018/01/31 21:54:47] Transfer summary:
-----------------
Total files transferred: 113
Transfer successfully: 113
Transfer skipped: 0
Transfer failed: 0
Elapsed time: 00.00:00:06
PS C:\Users\pks>
Upvotes: 0
Views: 2830
Reputation: 17530
Running with the following solved it
var container = await client.Containers.CreateContainerAsync(new CreateContainerParameters
{
Hostname = "",
Domainname = "",
User = "",
AttachStdin = false,
AttachStderr = f,alse
AttachStdout = false,
Tty = false,
Volumes = ...
Image = ...
Cmd = arguments,
HostConfig = new HostConfig
{
LogConfig = new LogConfig { Type = "json-file" },
AutoRemove = false,
Binds = binds
}
});
Upvotes: 1