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

How to specify config when creating a service

Open heppth opened this issue 6 years ago • 3 comments

Hi,

I want to speficy a config when creating a service. like this: docker service create -p 5000:80 --name test --config src=testConfig,target="app/testconfig.txt" myImage

How can I pass the configuration in the following code?

There seems to be no possibility to specify this

            await client.Swarm.CreateServiceAsync(new ServiceCreateParameters()
            {
                Service = new ServiceSpec()
                {
                    TaskTemplate = new TaskSpec
                    {
                        ContainerSpec = new ContainerSpec()
                        {
                            Image = "mirasoftde/test:aspnetapp"
                        }                        
                    },
                    EndpointSpec = new EndpointSpec()
                    {
                        Ports = new List<PortConfig>()
                        {
                            new PortConfig() { Name = "HTTP", Protocol = "tcp", TargetPort = 80, PublishedPort = 5000, PublishMode = "ingress" }
                        }
                    },
                    Name = name
                }
            });

heppth avatar Aug 21 '18 10:08 heppth

Unfortunately the version of the Docker API this library supports ATM didn't have this option. It will require a version update but I will add this as a feature request for the next version.

jterry75 avatar Aug 22 '18 16:08 jterry75

Hi, is there anything blocking/preventing this to be added? And in general, anything that explains why there has been no new feature or release in quite a few months?

m-barthelemy avatar Mar 17 '19 00:03 m-barthelemy

think this can be closed RE https://github.com/dotnet/Docker.DotNet/issues/609

dazinator avatar Mar 27 '24 12:03 dazinator