mariotoffia / FluentDocker

Use docker, docker-compose local and remote in tests and your .NET core/full framework apps via a FluentAPI
Apache License 2.0
1.31k stars 97 forks source link

`ExecuteOnRunning` doesn't seem to do anything #283

Open Marvin-Brouwer opened 1 year ago

Marvin-Brouwer commented 1 year ago

I have the following setup:

            builder.UseContainer()
            .UseImage("mcr.microsoft.com/mssql/server:2022-latest")
            .WithName(imageName)
            .WithHostName("sql")
            .WithEnvironment(
                @"ACCEPT_EULA=Y",
                $@"MSSQL_SA_PASSWORD={options.SaPassword}",
                @"MSSQL_PID=Express"
            )
            .AsUser("root")
            .CopyOnStart(createDbScriptPath, @"/src")
            .UseWorkDir("/src")
            .ExecuteOnRunning(dbCreateScripts.ToArray())
            .AsUser("mssql")
            .ExposePort(options.Port, 1433)
            .UseIpV4("127.0.0.1")
            .DeleteIfExists(false, true)
            //.WaitForProcess("/opt/mssql-tools/bin/sqlcmd")
            //.WaitForPort("1433/tcp", TimeSpan.FromSeconds(10))
            .WaitForMessageInLog(
                "Recovery is complete. This is an informational message only. No user action is required."
            );

The dbCreateScripts.ToArray() contains a couple of commands but one of them is to simply touch a file so I can see if it works. I get no errors, yet no file appears. And, I can see the other commands aren't executed too.

What am I doing wrong here?