CMD A :
docker run -p 80:80 –detach=true -v /var/log/container/nginx:/var/log –name=nginx -t imagename
CMD B :
docker run -d -p 80:80 –name=nginx -t imagename
what is difference between this 2 CMD . why CMD B is working but not A ? mean when i am running CMD B nginx container is not exiting but when i am using CMD A it is exiting instantly. but when CMD A has been used in userdata of AWS it is working fine .why it is so . i want to update the version of nginx in aws ? but i tried CMD A on my local system it is not giving any error but docker is exiting instantly . when i tried CMD B it is working .and same happening on aws Ec2 instance .but same cmd is present in userdata and it is working .but later it is not working in Ec2 instance terminal centos .
Below are the steps to reproduce the issue
Below 2 line is the content of dockerfile
COPY nginx.conf /etc/nginx/nginx.conf
below cmd i used to create image on ubuntu(mylocalsystem) and centos(Ec2 instance).
//docker build -t “image-name” .
than running docker run commands mentioned above and getting the issue.
my current os ubuntu 20.4 .
Ec2 instance version centos 7.4