根据Alpine wiki,我必须rc-service apache2 start在安装Apache 2之后运行.但是,rc-service在容器内运行的Alpine中没有.如何让服务命令在Docker容器中运行?
如何在 Alpine Linux 上列出给定软件包的所有可用软件包版本?
我在 apk 帮助中找不到任何有用的东西。
apk info bash 只显示最新的可用 bash 版本。
# apk info bash
bash-5.0.0-r0 description:
The GNU Bourne Again shell
bash-5.0.0-r0 webpage:
https://www.gnu.org/software/bash/bash.html
bash-5.0.0-r0 installed size:
1200128
Run Code Online (Sandbox Code Playgroud)
使用该--all标志,我只能获得该版本的一些附加信息:
# apk info --all bash
bash-5.0.0-r0 description:
The GNU Bourne Again shell
bash-5.0.0-r0 webpage:
https://www.gnu.org/software/bash/bash.html
bash-5.0.0-r0 installed size:
1200128
bash-5.0.0-r0 depends on:
/bin/sh
so:libc.musl-x86_64.so.1
so:libreadline.so.8
bash-5.0.0-r0 provides:
cmd:bash
bash-5.0.0-r0 has auto-install rule:
bash-5.0.0-r0 license:
GPL-3.0-or-later
Run Code Online (Sandbox Code Playgroud)
apk list并且apk list --available只列出最新版本的所有可用包。
所以如果我运行apk list -a …
在我将 bcrypt 添加到我的 package.json 之前,一切正常。现在,我收到以下错误消息。
这是我的 package.json 的摘录:
"dependencies": {
"bcrypt": "3.0.6",
"express": "^4.17.1",
"mongodb": "^3.3.1",
"nodemailer": "^6.3.0",
"pm2": "^3.5.1",
"redis": "^2.8.0",
"xlsx": "^0.15.0"
},
Run Code Online (Sandbox Code Playgroud)
这是我的 dockerfile。我正在使用官方节点高山图像。我想知道 alpine 是否已经安装了 phyton。
FROM node:13.5.0-alpine
WORKDIR /usr/app
COPY ./src .
RUN npm install
Run Code Online (Sandbox Code Playgroud)
我在运行 docker-compose 时收到此错误消息:
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v79-linux-x64-musl.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@13.5.0 (node-v79 ABI, musl) (falling back to source compile with node-gyp)
gyp ERR! find …Run Code Online (Sandbox Code Playgroud) 我不知道我是不是在做蠢事,所以请耐心等待。
tl; dr Rails ActiveSupport 时间和时区在 Alpine Linux 上似乎有错误。当它应该使用冬季时间时,它使用我的时区的 DST 变体(夏令时)。
重现步骤:
$ docker run -it --rm ruby:2.7.1-alpine sh
Run Code Online (Sandbox Code Playgroud)
以下所有步骤都发生在正在运行的 docker 容器内。
$ apk add --no-cache --update tzdata
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/1) Installing tzdata (2020c-r0)
Executing busybox-1.31.1-r9.trigger
OK: 23 MiB in 37 packages
Run Code Online (Sandbox Code Playgroud)
$ ruby -e 'puts Time.now.inspect'
2020-10-28 20:34:24.4817918 +0000
Run Code Online (Sandbox Code Playgroud)
看起来挺好的。时间以 UTC 打印。
Time类只能处理本地时间。这取决于本地系统时区,它可以使用操作系统配置机制进行配置,或者可以简单地通过TZenv var传递给 Ruby 。让我们尝试使用我的时区“欧洲/柏林”:$ TZ="Europe/Berlin" ruby -e …Run Code Online (Sandbox Code Playgroud) 我有一个运行 8.0 的 docker 映像,想要升级到 8.1。我已更新图像以使用 PHP 8.1 运行,并希望更新其中的依赖项。
新图像源自php:8.1.1-fpm-alpine3.15
我已更新composer.json并更改require.php为,^8.1但在运行时遇到以下消息composer upgrade:
Root composer.json requires php ^8.1 but your php version (8.0.14) does not satisfy that requirement.
Run Code Online (Sandbox Code Playgroud)
令我眼花缭乱的是,作曲家错误地识别了 PHP 版本。我使用两个命令来确定:
Root composer.json requires php ^8.1 but your php version (8.0.14) does not satisfy that requirement.
Run Code Online (Sandbox Code Playgroud)
到目前为止我已经尝试过:
php -v作曲家版本 2.1.12 2021-11-09 16:02:04
which php # returns only /usr/local/bin/php
/usr/local/bin/php -v # returns PHP 8.1.1 (cli) (built: Dec 18 …Run Code Online (Sandbox Code Playgroud) 我正在尝试在运行 alpine 的 Docker 容器中使用 Python 和 selenium 运行 chrome。它运行得很好,直到有一天,当我实例化 chrome 时,它开始抛出以下错误。
Message: unknown error: Chrome failed to start: crashed.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/lib/chromium/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Run Code Online (Sandbox Code Playgroud)
这是创建此错误的代码:
from selenium import webdriver
def generate_plugin():
pluginfile = 'proxy_auth_plugin.zip'
# manifest_json, background_js same as https://stackoverflow.com/a/61764363/9809865
with zipfile.ZipFile(pluginfile, 'w') as zp:
zp.writestr("manifest.json", manifest_json)
zp.writestr("background.js", background_js)
return pluginfile
chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications": 2} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用pip install uwsgi我的Alpine docker图像安装uwsgi 但不幸的是它一直没有出现奇怪的错误信息给我:
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-mEZegv/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c7XA_e-record/install-record.txt --single-version-externally-managed --compile:
running install
using profile: buildconf/default.ini
detected include path: ['/usr/include/fortify', '/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/include']
Patching "bin_name" to properly install_scripts dir
detected CPU cores: 1
configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_VERSION="\"2.0.12\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="12" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_PLUGIN_DIR="\".\"" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"core/utils.c: In function 'uwsgi_as_root':
core/utils.c:344:7: error: …Run Code Online (Sandbox Code Playgroud) 当我使用一些简单的高山容器时,码头工人开始产生奇怪的虫子.其中两个问题是:
rc-update 当我试图使用它时没有找到openssh软件包之后,没有任何内容/etc/ssh或没有/etc/init.d/sshd启动/重新启动服务为了避免混淆,我检查了一个广泛使用的容器,它充当一个简单的SSH服务器.你可以通过执行:
git clone https://github.com/chamunks/alpine-openssh.git
Run Code Online (Sandbox Code Playgroud)
在此之后进入alpine-openssh目录并使用以下内容构建容器:
docker build -t alpine-openssh .
Run Code Online (Sandbox Code Playgroud)
我的产品如下:
Sending build context to Docker daemon 125.4 kB
Step 1 : FROM alpine
---> 4e38e38c8ce0
Step 2 : MAINTAINER Chamunks <Chamunks@gmail.com>
---> Running in c21d3fa28903
---> f32322a2871a
Removing intermediate container c21d3fa28903
Step 3 : COPY sshd_config /etc/ssh/sshd_config
---> 392364fc35ce
Removing intermediate container 4176ae093cb8
Step 4 : ADD https://gist.githubusercontent.com/chamunks/38c807435ffed53583f0/raw/ec868d1b45e248eb517a134b84474133c3e7dc66/gistfile1.txt /data/.ssh/authorized_keys
Downloading [==================================================>] 864 B/864 B
---> c3899b675728
Removing …Run Code Online (Sandbox Code Playgroud) 我只想发送简单的电子邮件用于测试目的,但是在容器内执行 sendmail 时,我得到sendmail: can't connect to remote host (127.0.0.1): Connection refused. 在 Alpine 容器内使用 sendmail 时需要考虑什么?
在 Alpine 3.10.1 上,我尝试使用headless_chrome.
config.before(:each, type: :system, js: true) do
driven_by :selenium, using: :headless_chrome
end
Run Code Online (Sandbox Code Playgroud)
我已经安装capybara和webdrivers.
由于我还没有找到Chrome在 Alpine上安装的方法,我尝试过Chromium(76.0.3809.87-r0)。但是,当我运行规范时,它找不到驱动程序。
ChildProcess::LaunchError: 没有那个文件或目录 - /root/.webdrivers/chromedriver
我也试过chromium-chromedriver直接通过 apk安装,但结果是一样的。
有没有安装方式Chrome上高山,或使用Chromium与Capybara?