Update Dockerfile
Browse files- Dockerfile +5 -4
Dockerfile
CHANGED
|
@@ -2,8 +2,7 @@
|
|
| 2 |
FROM mariadb:10.5
|
| 3 |
|
| 4 |
# Set up a new user named "user" with user ID 1000
|
| 5 |
-
RUN useradd -m -u 1000
|
| 6 |
-
echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
| 7 |
|
| 8 |
# Switch to the "user" user
|
| 9 |
USER user
|
|
@@ -15,9 +14,11 @@ ENV HOME=/home/user \
|
|
| 15 |
# Set the working directory to the user's home directory
|
| 16 |
WORKDIR $HOME
|
| 17 |
|
| 18 |
-
# Create necessary directories and set permissions
|
|
|
|
| 19 |
RUN mkdir -p /var/lib/mysql /var/run/mysqld && \
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
# Set the environment variables for MariaDB
|
| 23 |
ENV MYSQL_ROOT_PASSWORD=rootpassword
|
|
|
|
| 2 |
FROM mariadb:10.5
|
| 3 |
|
| 4 |
# Set up a new user named "user" with user ID 1000
|
| 5 |
+
RUN useradd -m -u 1000 user
|
|
|
|
| 6 |
|
| 7 |
# Switch to the "user" user
|
| 8 |
USER user
|
|
|
|
| 14 |
# Set the working directory to the user's home directory
|
| 15 |
WORKDIR $HOME
|
| 16 |
|
| 17 |
+
# Create necessary directories and set permissions as root
|
| 18 |
+
USER root
|
| 19 |
RUN mkdir -p /var/lib/mysql /var/run/mysqld && \
|
| 20 |
+
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld && \
|
| 21 |
+
chmod 750 /var/lib/mysql /var/run/mysqld
|
| 22 |
|
| 23 |
# Set the environment variables for MariaDB
|
| 24 |
ENV MYSQL_ROOT_PASSWORD=rootpassword
|