Skip to content

Error "platform specifier component must match" when building Docker image #1102

Answered by mu88
mu88 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, if Buildx is available, the CLI will work.

I can confirm that the following code successfully builds the Docker image on my laptop:

var rootDirectory = Directory.GetParent(Environment.CurrentDirectory)?.Parent?.Parent?.Parent?.Parent ?? throw new NullReferenceException();
var dockerfile = Path.Join(rootDirectory.FullName, "src", "ScreenshotCreator.Api", "Dockerfile");
var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
        FileName = "docker",
        Arguments = $"build --platform linux/amd64 -f {dockerfile} -t screenshotcreator:dev {rootDirectory}",
        UseShellExecute = false,
        RedirectStandardOutput = true,
        CreateNoWindow = true
    }
};

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@HofmeisterAn
Comment options

@mu88
Comment options

@HofmeisterAn
Comment options

@mu88
Comment options

Answer selected by mu88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants