Skip to content

Should Composite Container Name be the composer.yml path? #278

@Fewiel

Description

@Fewiel

I need to set up a container and get the name back to start and stop it later.

Code to create the container:

var svc = new Builder()
    .UseContainer()
    .WithName("docker-container-1")
    .UseCompose().ServiceName("docker-container-1")
    .FromFile("/root/DockerFiles/test.yml")
    .RemoveOrphans()
    .Build().Start();

test.yml:

version: "3"

services:
    client:
        image: nginx
        ports:
            - 80:80
        volumes:
            - ./src:/usr/share/nginx/html

The svc.Name returns "/root/DockerFiles/test.yml"
I expected it to return: docker-container-1
docker container ls returns the correct container name (but with _client_1 added)

Please let me know if this is the correct way to set the name.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions