Docker.DotNet icon indicating copy to clipboard operation
Docker.DotNet copied to clipboard

Start a container using DockerCompose with --comaptibility option

Open mammadalius opened this issue 3 years ago • 0 comments

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;

mammadalius avatar Feb 27 '22 15:02 mammadalius