dotnet / dotnet/Docker.DotNet

Start a container using DockerCompose with --comaptibility option

Open
#557 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
416
PR merge metrics
No merged PRs in 30d

Description

I have a dockerCompose yaml file in version 3.8 with some setting to limit the memory of the container.
Because I don't use swarm, I should use the "--compatibility" flag to make it working.
I use this command and worked correctly by using docker cli.
My docker compose yaml:
```
version: '3.8'
services:
db:
image: "xxxxx:yyyy"
ports:
- "10001:22"
volumes:
- "C:/Shared:C:/Data/"
deploy:
resources:
limits:
memory: 1500m
```

> docker compose -f "C:\Temp\limit_compose2.yml" --compatibility up

I don't know how it could be possible to do it with Docker.DotNet?

I'm currently using Docker.DotNet 3.125.5 and start container like the following:
```
//filled containerParameters from docker compose yaml before and using it here

var containerCreateResult = client.Containers.CreateContainerAsync(containerParameter).Result;
var containerStartParameter = new ContainerStartParameters() { };
var startContainerResult = client.Containers.StartContainerAsync(containerCreateResult.ID, containerStartParameter).Result;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.