Unable to create new Docker container

I have started learning Docker very newly and while trying to create a container am getting the below error.

Command used:
docker run -p 3001:3000 --name=serve_container serve_image

Error - server: not found

Could someone please check and let me know if anything is incorrect here?

A little more context could be helpful. Are you running it in the appropriate directory? Do you actually have an image named serve_image?

You may need to build the image before running it. Again, not a whole lot of context to be able to tell if there’s an error in just your run command.

Yes, the image is already build before. I ran the command : docker image ls and can see the image in the list.
Also, using the above command(mentioned in the first post) the container is getting created but the status shows exited, and am running this in the correct directory.

I have been following a lecture in Udemy and was doing the hand-on in parallel so this is where I got stuck.

Try running logs on the container to see what errors you are getting that causes it to exit.

docker run -p 3001:3000 --name=serve_container serve_image && docker logs -f serve_container

Thanks for your suggestions. I cross checked everything and noticed that there was a small typo in the docker file. Once I fixed it, the issue got resolved.


Glad to hear you got it working.