Docker Community Forums

Share and learn in the Docker community.

*.* string literal altered at container runtime

Using docker version 1.13.1, build 1185cfd/1.13.1, Fedora 30 x64.

Steps to reproduce:

Dockerfile looks like the following:

WORKDIR ./root/webprod
COPY . /root/webprod

RUN ["chmod", "+x", "/root/webprod/install.sh"]
ENTRYPOINT ["/root/webprod/install.sh"]

install.sh contents

sqlstatement="DROP USER ''@'localhost';
[...]
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'placeholder' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'working'@'%' IDENTIFIED BY 'placeholder' WITH GRANT OPTION;"

echo $sqlstatement

docker build --tag=mainimage1 .

docker run -ti mainimage1 asdfffff

Output:

[...]) NOT NULL, event_date DATETIME NOT NULL, insert_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, norm VARCHAR(128), flow VARCHAR(32), device_hostname VARCHAR(128), source_ip VARCHAR(64), source_port VARCHAR(64), dest_ip VARCHAR(64), dest_port VARCHAR(64), source_user VARCHAR(128), norm_name VARCHAR(128), severity SMALLINT, event_count INT); GRANT ALL PRIVILEGES ON Dockerfile.dat.test install.sh TO 'root'@'%' IDENTIFIED BY 'placeholder' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON Dockerfile.dat.test install.sh TO 'working'@'%' IDENTIFIED BY 'placeholder' WITH GRANT OPTION; FLUSH PRIVILEGES

You can see that the actual *.* string was replaced by the directory contents of the /root/webprod directory. Has anyone else encountered this? I tried various tricks in bash to get around this with no luck.

Thanks