Fel*_*aes 7 laravel docker sqlsrv
我正在尝试将 Docker 映像与 Laravel + Microsoft SQL 驱动程序一起使用。
我的泊坞窗文件:
FROM php:7.2-apache
ENV ACCEPT_EULA=Y
# Microsoft SQL Server Prerequisites
RUN apt-get update \
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/9/prod.list \
> /etc/apt/sources.list.d/mssql-release.list \
&& apt-get install -y --no-install-recommends \
locales \
apt-transport-https \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen \
&& apt-get update \
&& apt-get -y --no-install-recommends install \
unixodbc-dev \
msodbcsql17
RUN docker-php-ext-install mbstring pdo pdo_mysql \
&& pecl install sqlsrv pdo_sqlsrv xdebug \
&& docker-php-ext-enable sqlsrv pdo_sqlsrv xdebug
COPY index.php /var/www/html/
# We need a user with the same UID/GID as the host user
# so when we execute CLI commands, all the host file's permissions and ownership remain intact.
# Otherwise commands from inside the container would create root-owned files and directories.
ARG uid
RUN useradd -G www-data,root -o -u $uid -d /home/devuser devuser
RUN mkdir -p /home/devuser/.composer && \
chown -R devuser:devuser /home/devuser
Run Code Online (Sandbox Code Playgroud)
使用 docker-compose build 进行构建时,我收到无效用户:
useradd: invalid user ID '-d'
The command '/bin/sh -c useradd -G www-data,root -o -u $uid -d /home/devuser devuser' returned a non-zero code: 3
Run Code Online (Sandbox Code Playgroud)
就我而言,原因是,我尝试直接使用构建图像
docker build --tag imagename .
而不是使用
docker-compose build app
从提供 $uid 值的地方。
| 归档时间: |
|
| 查看次数: |
9575 次 |
| 最近记录: |