0

enter image description here

I am new to docker. trying to go throw this tutorial. while running docker.

docker run -it --rm -p 5200:80 --name pizzabackendcontainer pizzabacken

I am getting the output in the image. what is the output suggest. i feel something wrong in the docker file

pcsutar
  • 1,715
  • 2
  • 9
  • 14
maztt
  • 12,278
  • 21
  • 78
  • 153
  • What's your expected result from your command lint? I saw you are doing container command line it is working – D-Shih Feb 06 '22 at 05:06
  • You can try to access `http://localhost:5200/pizzainfo` it might be work if you are doing the right thing from the document – D-Shih Feb 06 '22 at 05:09
  • http://localhost:5200/pizzainfo is not working – maztt Feb 06 '22 at 05:17
  • running the same command in the different tutorial started the container without the output in the picture above – maztt Feb 06 '22 at 05:22
  • You can try to use `docker run -itd -p 5200:80 --name pizzabackendcontainer-1 pizzabackend` – D-Shih Feb 06 '22 at 05:23
  • Had you build your image by this command `docker build -t pizzabackend .`? – D-Shih Feb 06 '22 at 05:24
  • yes it working docker run -itd -p 5200:80 --name pizzabackendcontainer-1 pizzabackend – maztt Feb 06 '22 at 05:58
  • Ok I see I will write an answer & more detail for you – D-Shih Feb 06 '22 at 09:26
  • It's not impossible that `docker run` a container would dump a PNG file to stdout and exit. What behavior do you actually expect? If you think something is wrong with the Dockerfile, can you edit the question to include it? In comments you suggest you should be running an HTTP server; is there further source code required for a [mcve]? – David Maze Feb 06 '22 at 10:28

1 Answers1

1

The tutorial guide us docker run -it --rm -p 5200:80 --name pizzabackendcontainer pizzabackend

  • -it: That means you will execute the container by terminal mode.
  • -rm: Automatically remove the container when it exits

So when you execute the command you will be interactive container command line and the container will be stopped when you exit.

docker run -itd -p 5200:80 --name pizzabackendcontainer-1 pizzabackend

If you want to run a container and keep it in your original terminal you can try to add -d parameter that will run the container in the background and print container ID.

more detail about docker run parameter you can refer docker run

D-Shih
  • 44,943
  • 6
  • 31
  • 51