标签: alpine-linux

为什么 crond 无法在 alpine linux 上运行非 root crontab?

我在 Alpine Linux 上运行非 root crontab 文件时遇到了麻烦。

我已经阅读了另外两个与 cron 相关的帖子,但我没有答案:

https://askubuntu.com/questions/23009/why-crontab-scripts-are-not-working

https://serverfault.com/questions/449651/why-is-my-crontab-not-working-and-how-can-i-troubleshoot-it

这是设置。

我的 crontab 看起来像这样:

PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/bin
SHELL=/bin/bash

* * * * * /opt/monitor/monitor.sh >> /var/log/monitor.log 2>&1
0 3 * * * /opt/monitor/monitor-log-clean.sh >> /var/log/monitor.log 2>&1
Run Code Online (Sandbox Code Playgroud)

我的 Dockerfile 现在有点乱,但这只是因为我一直在拼命尝试解决这个问题。它看起来像这样。简而言之,我为 crontab -e 添加 SUID 以作为其他用户工作,我创建我的用户,我导入我的 crontab 文件,然后我为我能想到的所有内容提供权限。

FROM alpine:3.5

# DEPENDENCY TO ALLOW USERS TO RUN crontab -e
RUN apk add --update busybox-suid

# I LIKE BASH
RUN apk --no-cache add bash bash-doc
RUN apk --no-cache add util-linux pciutils usbutils coreutils …
Run Code Online (Sandbox Code Playgroud)

linux cron docker alpine-linux

8
推荐指数
1
解决办法
9633
查看次数

Docker:在 alpine linux 发行版上安装 python 加密

我对 Docker 和部署周期有点陌生。

我有一个 Django 应用程序,我们想用 uWSGI 将它部署到 docker 容器。实际上部署完美地工作了几个星期,但现在它完全报告错误......

错误接缝与密码学包有关:

build/temp.linux-x86_64-3.6/_openssl.c:52862:10: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
build/temp.linux-x86_64-3.6/_openssl.c: In function '_cffi_f_SSL_set_options':
build/temp.linux-x86_64-3.6/_openssl.c:52895:14: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
   { result = SSL_set_options(x0, x1); }
              ^~~~~~~~~~~~~~~
build/temp.linux-x86_64-3.6/_openssl.c:52895:14: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
error: command 'gcc' failed …
Run Code Online (Sandbox Code Playgroud)

uwsgi docker dockerfile alpine-linux python-cryptography

8
推荐指数
2
解决办法
9869
查看次数

lsof 可以在 alpine linux 上显示开放端口吗?

我有一个在 alpine linux 中运行的 Spring Boot 应用程序,监听端口 8080。但是,当我这样做时:

$ lsof
$ lsof -i 8080
Run Code Online (Sandbox Code Playgroud)

它不显示打开的端口。你知道我做错了什么吗?

似乎 lsof 在 alpine linux 上不尊重任何论点。它总是显示相同的输出 - 似乎忽略了 -i。

谢谢你。

磷

在此处输入图片说明

linux port networking lsof alpine-linux

8
推荐指数
1
解决办法
1万
查看次数

在 Alpine 中找不到运行时/cgo

alpine:edge我安装的容器中,通过

RUN apk add --no-cache musl-dev go
Run Code Online (Sandbox Code Playgroud)

那我试着跑go get github.com/golang/protobuf/protoc-gen-go

这会导致错误消息:

go: finding github.com/golang/protobuf/protoc-gen-go latest
go: finding github.com/golang/protobuf v1.3.1
go: downloading github.com/golang/protobuf v1.3.1
go: extracting github.com/golang/protobuf v1.3.1
# github.com/golang/protobuf/protoc-gen-go
loadinternal: cannot find runtime/cgo
protoc-gen-go: program not found or is not executable
Run Code Online (Sandbox Code Playgroud)

现在查看代码,它失败了ctxt.PackageFile[name]

我双重检查,虽然,这两个/usr/lib/go/pkg/tool/linux_amd64/cgo/usr/lib/go/pkg/linux_amd64/runtime/cgo.a都存在。

应该按照go env以下顺序排列:

GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g …
Run Code Online (Sandbox Code Playgroud)

go alpine-linux

8
推荐指数
1
解决办法
7799
查看次数

如何修复:“在 MS SQL Server 重新启动使用它的 alipne .net core 2.2.5 容器后,有一个 CLOSE_WAIT tcp 连接 - dotnet 的 CPU 上升”

我对托管在官方 asp-dotnet-core-alipne 容器和其他服务器上的 SQL Server 上的应用程序有问题。重启我们有 SQL 的服务器后,容器获得高 CPU 和一些内部线程挂起。仅帮助重启容器。我们调查了在这种情况发生时,有一些 tcp 连接处于 CLOSE_WAIT 状态。关于应用程序和服务器的一些信息:

关于应用程序的详细信息:

  • .net 核心 2.2 (C#)
  • 基于官方高山容器 (mcr.net.core.asp:2.2.5-alpine3.9)
  • 使用 Dapper 以及 ADO.NET
  • 使用带有 async/await 的 Async 方法
  • 使用 Quartz.NET 进行作业调度

有关 Docker 的详细信息

  • 托管在 Centos 7
  • 使用 Docker 19.03

SQL Server 的详细信息:

  • MS SQL 2014 标准 x64
  • 视窗服务器 2012R2
  • 托管在虚拟机上

详细问题描述:

带有应用程序的容器在安装了 docker 的 linux 服务器(Centos 7)上 24/7 全天候工作。在同一台服务器上有安装了 Windows Server 和 MS SQL Server 2014 的虚拟机。如果存在一些网络问题和其他问题,应用程序可以正常工作,但在重新启动此服务器后,我收到错误消息:

[19-08-09 04:15:44.15 ERR -- SSI.Pojazd 0216NPIK] Job SSI.Pojazd.retry_Sms_RetryJob`1 threw an …
Run Code Online (Sandbox Code Playgroud)

c# sql docker .net-core alpine-linux

8
推荐指数
0
解决办法
446
查看次数

如何使用pipenv为python应用程序制作轻量级docker镜像

我可以使用以下简单的方法为我的 python 应用程序生成工作图像Dockerfile

FROM python:3.7
WORKDIR /myapp
COPY Pipfile* ./
RUN pip install pipenv
RUN pipenv install --system --deploy
COPY src .
CMD ["python3", "app.py"]
Run Code Online (Sandbox Code Playgroud)

但是,它会生成大约 1 GB 的映像,其中可以包含临时文件,并且部署起来很繁重。而且我只需要完整的 python 图像用于构建目的。我的应用程序可以在 alpine 变体上成功运行,因此我可以进行两次Dockerfile

FROM python:3.7 as builder
COPY Pipfile* ./
RUN pipenv lock --requirements > requirements.txt
RUN python3 -m venv /venv
RUN /venv/bin/pip install --upgrade pip
RUN /venv/bin/pip install -r requirements.txt

FROM python:3.7-alpine
COPY --from=builder /venv /venv
WORKDIR /myapp
COPY src .
CMD ["/venv/bin/python3", "app.py"]
Run Code Online (Sandbox Code Playgroud)

到目前为止一切顺利,它也有效,体积缩小了 …

python docker dockerfile alpine-linux pipenv

8
推荐指数
2
解决办法
7009
查看次数

是否可以在 Alpine 3.12 Docker 镜像上安装 PHP7.4?

是否可以在Alpine 3.12 Docker 镜像上安装 PHP7.4 ?

我已经看到这个 repo及其使用 bintray 证书和存储库路径的 dockerfile,但我想知道是否有更“标准/高山”的本地方式来做这件事?

php linux docker alpine-linux php-7.4

8
推荐指数
2
解决办法
8115
查看次数

Alpine Linux 容器上的 Flutter 安装无法“pub 升级”

我想在运行 Alpine Linux 的 Docker 容器上安装 Flutter。

我写了以下内容Dockerfile

FROM alpine

RUN apk add bash curl file git zip
RUN git clone https://github.com/flutter/flutter.git
ENV PATH="$PATH:/flutter/bin"
RUN flutter channel stable
Run Code Online (Sandbox Code Playgroud)

一切都很顺利,直到最后一步,我得到:

Step 5/5 : RUN flutter channel stable
 ---> Running in f8e764b1e091
Downloading Dart SDK from Flutter engine 82b4ae86d69b4bad10a42ad380f2a538d97ffb38...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  174M  100  174M    0     0  23.1M      0  0:00:07  0:00:07 --:--:-- 23.8M
Building …
Run Code Online (Sandbox Code Playgroud)

linux docker alpine-linux flutter

8
推荐指数
1
解决办法
3080
查看次数

Alpine Docker 定义特定的 python 版本 (python3-3.8.7-r0:breaks: world[python3=3.6.9-r3])

当我想构建 Alpine Docker 时,在定义特定的 python 版本时出现错误。

我的 Dockerfile:

FROM python:3-alpine

RUN apk --no-cache add build-base openldap-dev python2-dev 'python3=3.6.9-r3' 'python3-dev=3.6.9-r3'
RUN pip3 install python-ldap sqlalchemy requests
ADD ucs-root-ca.crt /usr/local/share/ca-certificates/foo.crt
RUN chmod 644 /usr/local/share/ca-certificates/foo.crt && update-ca-certificates

COPY templates ./templates
COPY api.py filedb.py syncer.py ./

VOLUME [ "/db" ]
VOLUME [ "/conf/dovecot" ]
VOLUME [ "/conf/sogo" ]

ENTRYPOINT [ "python3", "syncer.py" ]
Run Code Online (Sandbox Code Playgroud)

当我想构建我的 dockerfile 时出现以下错误:

ERROR: unable to select packages:
  python3-3.8.7-r0:
    breaks: world[python3=3.6.9-r3]
    satisfies: python3-dev-3.8.7-r0[python3=3.8.7-r0]
  python3-dev-3.8.7-r0:
    breaks: world[python3-dev=3.6.9-r3]
The command '/bin/sh -c apk …
Run Code Online (Sandbox Code Playgroud)

python python-3.x docker alpine-linux

8
推荐指数
1
解决办法
2万
查看次数

alpine:3.14 docker libtls.so.20 conflict

So I am running into an error with the latest docker build from alpine. alpine:3.14.0 was released about a day ago and was trying to install libressl and libressl-dev and both seem to fail with the error below. My work around at the moment was to build using the alpine:3.12.0 as 3.12.0 seems to not have libretls installed. Although I would like to know how to fix this. I tried to remove libretls but that didn't work (error also below). …

docker libressl alpine-linux

8
推荐指数
1
解决办法
2250
查看次数