Cant build worker image for the voting app demo || worker - Dockerfile

As I was building the images for the voting application, I found the below issue

Building image for: worker
Dockerfile: https://github.com/dockersamples/example-voting-app/tree/main/worker

Command used: ~/Documents/kk_voting_app/example-voting-app/worker$ sudo docker build -t worker .

Error output:

DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/
Sending build context to Docker daemon  9.728kB
Step 1/14 : FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 as build
failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument

An example of how to build the dockerfile is given in the comments in the dockerfile.
You haven’t specified a target platform for the build.

For Intel processor machines (everything except M-Series Macs), the command would be

docker buildx build --platform linux/amd64 .

Tried the above, the buildx command is not recognized

hey, the buildx seems to work now. But, even though I have successfully run the worker container, it is not functioning as excepted

After I cast the vote. In the results web page, I’m only shown with the result of 50:50, no matter if I change my vote, its not changing the result. I doubt this issue may be linked to the worker container. But I’m not sure why

I can’t comment on the functionality of the system itself without digging into all the code.
The exercise is to prove that you can stand up a multi container application and all the components talk to each other - which you have done.

As a DevOps engineer, your work is complete here. Incorrect operation of the application itself is something that DevOps would send back to the development team,

Understandable! thanks for the troubleshooting.

Another observation is that, the same application I ran it using docker-compose technique and it worked fine.

Try this, I was facing the same issue in the excercise. But finally got it working:

First install buildx:

sudo apt install docker-buildx

Then build with the command given in the Dockerfile for the worker:

docker buildx build --platform "linux/arm64/v8" . -t worker-app

And then the image is ready:

root@ubuntu:/home/asulikeri/codebase/udemy/example-voting-app/worker# docker images
REPOSITORY        TAG         IMAGE ID       CREATED             SIZE
worker-app        latest      e219b0a20939   49 seconds ago      196MB```