这是我的Dockerfile
FROM php:7.1-fpm-alpine
RUN docker-php-ext-install mysqli
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories &&
apk update && \
apk upgrade && \
apk add --update \
php7-gd
Run Code Online (Sandbox Code Playgroud)
mysqli没问题,但是它没有加载GD库.
我也在高山容器中找到gd.so,请查看图片:
请帮忙
我正在尝试在高山上安装git 3.6.它Protocol error在第一个实例中失败但在第二个实例上工作.具体pcre而libcurl不是在第一个实例中安装.这是我想要做的日志.
$ docker run -it alpine:3.6 /bin/sh
/ # apk --update add git
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/6) Installing ca-certificates (20161130-r2)
(2/6) Installing libssh2 (1.8.0-r1)
(3/6) Installing libcurl (7.56.1-r0)
ERROR: libcurl-7.56.1-r0: Protocol error
(4/6) Installing expat (2.2.0-r1)
(5/6) Installing pcre (8.41-r0)
ERROR: pcre-8.41-r0: Protocol error
(6/6) Installing git (2.13.5-r0)
Executing busybox-1.26.2-r9.trigger
Executing ca-certificates-20161130-r2.trigger
2 errors; 24 MiB in 15 packages
/ # git
Error loading shared library libpcre.so.1: No such file …Run Code Online (Sandbox Code Playgroud) 我已经搜索过,但似乎找不到此错误的答案。创建新虚拟机时出现“错误:无法删除非 root 用户的权限”。
容器不断重新启动。它在我本地的 MacOS 机器上运行得很好。
我正在尝试在具有容器优化操作系统的 Google Compute Engine VM 上运行该映像。我正在使用 nginx、php-fpm 和 alpine。
Supervisord.conf 文件如下所示:
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
pidfile=/run/supervisord.pid
user=root
[program:php-fpm]
command=php-fpm8 -F
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autostart=true
autorestart=true
priority=5
stdout_events_enabled=true
stderr_events_enabled=true
[program:nginx]
command=nginx -g 'daemon off;'
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0
Run Code Online (Sandbox Code Playgroud)
有人也遇到过这个错误吗?
Alpine 中是否可以安装有效的 CloudWatch 代理包?我们希望在 Alpine 上为 CloudWatch Agent 构建自定义 docker,但可以在https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html中进行下载中的可用下载似乎不起作用(我尝试了一些 deb 或 rpm)。
一些错误:无法安装下载的 deb 文件:
/ # dpkg -i -E amazon-cloudwatch-agent.deb
dpkg: error processing archive amazon-cloudwatch-agent.deb (--install):
package architecture (amd64) does not match system (musl-linux-amd64)
Run Code Online (Sandbox Code Playgroud)
并无法安装下载的 rpm 文件:
/ # rpm -U amazon-cloudwatch-agent.rpm
error: Failed dependencies:
/bin/sh is needed by amazon-cloudwatch-agent-1.247347.6b250880-1.x86_64
Run Code Online (Sandbox Code Playgroud)
CloudWatch Agent 是否支持 Alpine 有明确的答案吗?显然它是由 CloudWatch Log Agent 支持的。
我正在使用 Alpine、php7.2-fpm 和 Composer 构建 Docker 镜像。
尝试安装 Composer 时会出现问题,它使用 https 通过 php 下载安装程序。
我添加了存储库以便能够安装 php7.2(用于安装 Composer)及其软件包:
RUN wget -O /etc/apk/keys/phpearth.rsa.pub https://repos.php.earth/alpine/phpearth.rsa.pub && \
echo "https://repos.php.earth/alpine/v3.7" >> /etc/apk/repositories && \
apk update
Run Code Online (Sandbox Code Playgroud)
当我尝试下载composer时出现以下错误:
/ # php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
PHP Warning: copy(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
PHP 2. copy() Command line …Run Code Online (Sandbox Code Playgroud) 我正在寻找基于 alpine 的 openjdk 17 docker 镜像。看起来我们这里有一个
但下面的存储库显示它尚未准备好正式发布。所以我想知道上面的docker镜像从哪里获取源文件。
我在 MacOS 上通过 Docker Desktop 运行 Docker,在容器中安装软件包时遇到很多麻烦,因为它无法验证任何 ssl 证书。
\napk update例如,当我运行时,我收到此错误:
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz\n139797308250952:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1914:\nERROR: https://dl-cdn.alpinelinux.org/alpine/v3.14/main: Permission denied\nRun Code Online (Sandbox Code Playgroud)\n当我尝试bundle install:
Could not verify the SSL certificate for https://rubygems.org/.\nThere is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn\'t have the CA certificates needed for verification.\nRun Code Online (Sandbox Code Playgroud)\n甚至是一个简单的卷曲curl https://google.com.br:
curl: (60) SSL certificate problem: unable to get local issuer certificate\nMore details here: https://curl.se/docs/sslcerts.html\n\ncurl failed to …Run Code Online (Sandbox Code Playgroud) 我阅读了一些Docker 和 Node.js 最佳实践文章,例如https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md或使用 Docker 容器化 Node.js Web 应用程序的 10 个最佳实践,或者Node 和 NPM 的 Dockerfile 良好实践。所有这些文章至少是在 2021 年写或更新的,我不列出 2021 年之前写的文章,但也有不少。
\n他们都反对CMD ["npm", "run", "start"]。主要原因是 npm 会吞掉SIGTERM 和 SIGINT 等退出信号,因此我的节点应用程序中的正常关闭代码将无法运行。
我猜旧的 npm 就是这种情况(虽然我没有测试它),但我已经测试了 node14+npm6 和 node16+npm8,我可以验证 npm6/8 不会吞下这些事件和我的优雅关闭代码正在运行。不确定这是否是因为 npm 修复了它。
\n因此,唯一的问题仍然是还有 1 个进程 npm 需要运行,即 NPM 作为PID 1运行。一些文章说问题是“PID 1 不会响应 SIGINT”,但据我证实,情况并非如此。
\n许多文章(例如这个nodejs文档)建议只是,CMD [ "node", "server.js" ]但也在https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals …
我的目标是理解为什么会有nginx图像和nginx:alpine图像。
我知道的:
nginx更大,52.79 MB。nginx使用debian:bullseye-slim.nginx:alpine较小,为 9.51 MB。nginx:alpine使用alpine.docker run -p 8080:80 -v ${PWD}:/usr/share/nginx/html nginx:alpine我无法理解为什么默认图像使用debian:bullseye-slim而不是alpine.
当尝试在我的 PHP 8.1 alpine docker 容器中格式化货币时,我总是得到默认区域设置 (en_US)。
\n$ docker run -it --rm php:8.1-fpm-alpine /bin/ash\n# apk update && apk add icu-dev\n# docker-php-ext-configure intl && docker-php-ext-install intl\n# php -a\n> $formatter = new NumberFormatter('nl_NL', NumberFormatter::CURRENCY);\n> echo $formatter->getLocale();\nen_US\n> echo $formatter->format(1234.567);\n\xe2\x82\xac1,234.57\nRun Code Online (Sandbox Code Playgroud)\n我期望 getLocale() 返回 nl_NL 和 format 返回 \xe2\x82\xac1.234,57。
\n如果我尝试 locale en_GB,getLocale() 确实返回 en_GB。
\n也欢迎任何有关编写更好问题的建议。
\nalpine-linux ×10
docker ×7
php ×4
nginx ×2
composer-php ×1
debian-based ×1
dockerfile ×1
gd ×1
intl ×1
java ×1
macos ×1
node.js ×1
npm ×1
openjdk-17 ×1
php-openssl ×1
signals ×1
ssl ×1