Docker exec reported an error. what’s going on?

  docker, question
admin@ubuntu:/mnt/data/web$ sudo docker exec web-server -i -t /bin/bash
 rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \  "exec: \\\"-i\\\": executable file not found in $PATH\"\n"

By the way, I have another question. My dockerfile file reads as follows

FROM ubuntu:latest
 RUN apt-get -qq update
 RUN apt-get install -qqy nginx php-fpm php-mcrypt
 RUN rm -rf /var/lib/apt/lists/*
 EXPOSE 80 443
 CMD ["/etc/init.d/nginx", "start"]

After I build well, the container will exit after running, and then I start:

admin@ubuntu:/mnt/data/web$ sudo docker start -a -i web-server
 cat: /etc/nginx/nginx.conf: No such file or directory
 * Starting nginx nginx!

That’s it. What is going on here?
My run command is as follows:

sudo docker run --name web-server --link db-mysql:mysql -v /mnt/data/web/htdocs -v /mnt/data/web/nginx.conf.d:/etc/nginx -p 80:80 -p 443:443 -d nginx-php:latest

I’ve tried everything in the virtual machine in the company. I went home and ran to my vps. I just couldn’t do it. I’m so angry. . . . .

  1. Docker exec reported the error because the /bin/bash file does not exist, so you can try /bin/sh, etc.

  2. Check whether there are any nginx.conf files in the directory of the host/mnt/data/web/nginx.conf.d.

  3. The use of docker does not follow best practices. Please refer to the configuration of web server.Docker Practice (8): Building Laravel Development Environment.

  4. Please read carefully before learning docker.Snails under the Bridge-´╝ŹDocker Quiz (93 Questions).