Open Fewiel opened 1 year ago
Hi @Fewiel - this is by design. It will return a ICompositeService and it's composition is determined by the "/root/DockerFiles/test.yml". Inspect the contained services to get their respective name.
If there are any problems, please let me know.
From README.md
var file = Path.Combine(Directory.GetCurrentDirectory(),
(TemplateString) "Resources/ComposeTests/WordPress/docker-compose.yml");
// @formatter:off
using (var svc = new Builder()
.UseContainer()
.UseCompose()
.FromFile(file)
.RemoveOrphans()
.WaitForHttp("wordpress", "http://localhost:8000/wp-admin/install.php")
.Build().Start())
// @formatter:on
{
// We now have a running WordPress with a MySql database
var installPage = await "http://localhost:8000/wp-admin/install.php".Wget();
Assert.IsTrue(installPage.IndexOf("https://wordpress.org/", StringComparison.Ordinal) != -1);
Assert.AreEqual(1, svc.Hosts.Count); // The host used by compose
Assert.AreEqual(2, svc.Containers.Count); // We can access each individual container
Assert.AreEqual(2, svc.Images.Count); // And the images used.
}
I need to set up a container and get the name back to start and stop it later.
Code to create the container:
test.yml:
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.