Docker 执行run操作其中的-e参数没有被正常写入环境变量
创建Docker 容器
```bash
root@lszVKWYaD7:/home/tmp/s3-6/s3-6# docker run -itd -p 2001:22 -e passwd=123456 test
0a4c5cdd74f3392afa28f3b8a5c728d5006861533e8ac74efca7482feb36c1fc
root@lszVKWYaD7:/home/tmp/s3-6/s3-6# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0a4c5cdd74f3 test "supervisord -n" 2 seconds ago Up 1 second 80/tcp, 0.0.0.0:2001->22/tcp, :::2001->22/tcp confident_austin
查看创建的容器是否被写入到环境变量
```bash
root@lszVKWYaD7:/home/tmp/s3-6/s3-6# docker exec 0a env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=0a4c5cdd74f3
passwd=123456
HOME=/root
通过上面的内容可以看到passwd的内容确实是123456,但是该镜像中的Dockerfile中,会将passwd变量赋值给ssh密码,为什么密码仍然是Dockerfile中初始化的666666,而不是Docker run中的123456
Dockerfile内容如下
```bash
FROM ubuntu:14.04
ENV passwd=666666
COPY html/ /var/www/html/
RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.tuna.tsinghua.edu.cn\/ubuntu\//g' /etc/apt/sources.list && \
sed -i '/security/d' /etc/apt/sources.list && \
apt-get update -y && \
apt-get -yqq install supervisor mariadb-server apache2 php5 libapache2-mod-php5 \
php5-mysql php5-mcrypt ssh && \
apt-get install php5-gd -y && \
service apache2 restart && \
# config
sed -i "154s/Indexes//" /etc/apache2/apache2.conf && \
sed -i "165s/Indexes//" /etc/apache2/apache2.conf && \
/etc/init.d/apache2 start && \
# supervisor
RUN mkdir -p /var/log/supervisor && \
mv /var/www/html/supervisord.conf /etc/ && \
#
chown -R www-data:www-data /var/www/html/ && \
chmod -R 755 /var/www/html/ && \
rm /var/www/html/db.sql /var/www/html/index.html && \
cat /dev/null > /var/www/html/log.php
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN useradd -g www-data ctf -m && \
password=$(openssl passwd -1 -salt 'abcdefg' $passwd) && \
sed -i 's/^ctf:!/ctf:'$password'/g' /etc/shadow
RUN chmod -R 777 /var/www/html
RUN mkdir /var/run/sshd
RUN echo 'flag{test_flag}' > /flag.txt
EXPOSE 80
EXPOSE 22
ENTRYPOINT ["supervisord", "-n"]
```