I have an Azurite container running in Docker Desktop:
I use .NET to implement upload, this is the code:
public async Task<Uri> UploadAsync(IFormFile file, CancellationToken cancellationToken = default)
{
var fileName = $"{Guid.NewGuid()}{MimeTypeMap.GetExtension(file.ContentType)}";
var container = new BlobContainerClient(_configuration.ConnectionString, _configuration.ContainerName);
var blobClient = container.GetBlobClient(fileName);
await blobClient.UploadAsync(file.OpenReadStream(), cancellationToken);
return blobClient.Uri;
}
When I use "http://host.docker.internal:10000/devstoreaccount1" I can upload blobs (specifically images) without any issues. Generated URL looks like this:
"http://host.docker.internal:10000/devstoreaccount1/images/d2cb8b81-65d3-4b09-94b2-0907c01bf3ff.png"
But when I want to download (retrieve) image using that URL (and access token) I get "net::ERR_CONNECTION_TIMED_OUT" error. Although if I replace "host.docker.internal" with "127.0.0.1" I can download image without issues. But, if I try to upload using "127.0.0.1" address I get:
"Retry failed after 6 tries. Retry settings can be adjusted in ClientOptions.Retry. (Connection refused (127.0.0.1:10000))" error.
I found two solutions for an issue I faced: