AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-831608

Dmitriano's questions

Martin Hope
Dmitriano
Asked: 2025-01-30 03:36:20 +0800 CST

无法在 Docker 容器内安装 build-essential

  • 4

我收到以下错误:

3.033 Err:32 http://security.ubuntu.com/ubuntu noble-updates/main amd64 linux-libc-dev amd64 6.8.0-51.52
3.034   404  Not Found [IP: 91.189.91.82 80]

尝试在 Docker 容器内运行以下命令时:

FROM ubuntu:24.04

RUN apt update
RUN apt upgrade

RUN apt -y install build-essential

这是与 DNS 相关的问题吗?

/etc/resolv.conf在 Docker 容器中:

# Generated by Docker Engine.
# This file can be edited; Docker Engine will not make further changes once it
# has been modified.

nameserver 172.236.0.51
nameserver 172.236.0.54
nameserver 172.236.0.48
nameserver 172.236.0.46
nameserver 172.236.0.50
nameserver 172.236.0.47
nameserver 172.236.0.53
nameserver 172.236.0.52
nameserver 172.236.0.45
nameserver 172.236.0.49
search members.linode.com ip.linodeusercontent.com

# Based on host file: '/run/systemd/resolve/resolv.conf' (legacy)
# Overrides: []

/etc/resolv.conf它与我的主机(Ubuntu 24.04)不同:

ll /etc/resolv.conf
lrwxrwxrwx 1 root root 37 Jan 23 18:19 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
cat /etc/resolv.conf

nameserver 127.0.0.53
options edns0 trust-ad
search members.linode.com ip.linodeusercontent.com

但/run/systemd/resolve/resolv.conf在主机上匹配。

我不明白为什么resonv.conf我的主机上有两个不同的。

还不太清楚Docker 容器内的 DNS 是否配置正确。

编辑1

Docker容器中的路由:

ip route show
default via 172.17.0.1 dev eth0
172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.3

主机上的路由:

ip route show
default via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
172.18.0.0/16 dev br-7c0ebcfd4e3a proto kernel scope link src 172.18.0.1
172.20.0.0/16 dev br-99d8bde8e488 proto kernel scope link src 172.20.0.1
172.236.0.45 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.46 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.47 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.48 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.49 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.50 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.51 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.52 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.53 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.0.54 via 172.236.29.1 dev eth0 proto dhcp src 172.236.29.157 metric 1024
172.236.29.0/24 dev eth0 proto kernel scope link src 172.236.29.157 metric 1024
172.236.29.1 dev eth0 proto dhcp scope link src 172.236.29.157 metric 1024

从 Docker 容器中:

ping 91.189.91.82
PING 91.189.91.82 (91.189.91.82) 56(84) bytes of data.
64 bytes from 91.189.91.82: icmp_seq=1 ttl=47 time=82.5 ms
64 bytes from 91.189.91.82: icmp_seq=2 ttl=47 time=82.6 ms

telnet security.ubuntu.com 80
Trying 91.189.91.81...
Connected to security.ubuntu.com.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

编辑2

从 Docker 容器中:

root@4e534b3b6847:/# apt install --no-cache linux-libc-dev
E: Command line option --no-cache is not understood in combination with the other options
root@4e534b3b6847:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay          49G   34G   15G  70% /
tmpfs            64M     0   64M   0% /dev
shm              64M     0   64M   0% /dev/shm
/dev/sda         49G   34G   15G  70% /etc/hosts
tmpfs           985M     0  985M   0% /proc/acpi
tmpfs           985M     0  985M   0% /proc/scsi
tmpfs           985M     0  985M   0% /sys/firmware

root@4e534b3b6847:/# apt clean
root@4e534b3b6847:/# apt install linux-libc-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
linux-libc-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,769 kB of archives.
After this operation, 7,508 kB of additional disk space will be used.
Ign:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 linux-libc-dev amd64 6.8.0-51.52
Err:1 http://security.ubuntu.com/ubuntu noble-updates/main amd64 linux-libc-dev amd64 6.8.0-51.52
404  Not Found [IP: 185.125.190.82 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_6.8.0-51.52_amd64.deb  404  Not Found [IP: 185.125.190.82 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

编辑3

在主机上:

  $ apt-cache policy linux-libc-dev
  linux-libc-dev:
  Installed: 6.8.0-52.53
  Candidate: 6.8.0-52.53
  Version table:
  *** 6.8.0-52.53 500
        500 http://mirrors.linode.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     6.8.0-31.31 500
        500 http://mirrors.linode.com/ubuntu noble/main amd64 Packages

在 Docker 容器中:

  # apt-cache policy linux-libc-dev
  linux-libc-dev:
  Installed: (none)
  Candidate: 6.8.0-51.52
  Version table:
     6.8.0-51.52 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
     6.8.0-31.31 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages
domain-name-system
  • 1 个回答
  • 110 Views
Martin Hope
Dmitriano
Asked: 2025-01-27 07:07:19 +0800 CST

OpenVPN 客户端无需客户端到客户端选项即可互相看到

  • 5

我在 Docker 容器中运行一个实验性的 VPN 服务器。

我的docker-compose.yml文件:

version: '3'
services:
dockovpn:
    image: alekslitvinenk/openvpn
    cap_add:
        - NET_ADMIN
    ports:
        - 1194:1194/udp # Expose tcp if you defined HOST_TUN_PROTOCOL=tcp
    environment:
        HOST_ADDR: ${HOST_ADDR}
    volumes:
        - /var/lib/dockovpn:/opt/Dockovpn_data
    restart: always

HOST_ADDR我的 IP 地址在哪里?

我使用

sudo docker-compose up -d

命令,我可以从 Windows、Android 和 iOS 设备连接到 VPN。

没有client-to-client选项server.conf:

sudo docker exec -it dockovpn_dockovpn_1 bash
cd /opt/Dockovpn
cat config/server.conf

port 1194
proto %HOST_TUN_PROTOCOL%
dev tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/MyReq.crt
key /etc/openvpn/MyReq.key
dh /etc/openvpn/dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
duplicate-cn
keepalive 10 120
cipher AES-256-GCM
ncp-ciphers AES-256-GCM:AES-256-CBC
auth SHA512
persist-key
persist-tun
status openvpn-status.log
verb 4
tls-server
tls-version-min 1.2
tls-auth /etc/openvpn/ta.key 0
crl-verify /etc/openvpn/crl.pem

因此,根据OpenVPN 文档,客户端不应该互相看到对方,但实际上他们可以看到对方。例如,我可以通过远程桌面连接到 IP 地址为 10.8.0.14 等的远程 Windows 计算机...

如何解决这个问题?

编辑1

在scripts\start.sh中找到以下内容:

# Allow traffic on the TUN interface.
iptables -A INPUT -i tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -j ACCEPT
iptables -A OUTPUT -o tun0 -j ACCEPT

也许我最好删除iptables -A FORWARD -i tun0 -j ACCEPT而不是添加iptables -A FORWARD -i tun0 -o tun0 -j REJECT?

openvpn
  • 1 个回答
  • 94 Views
Martin Hope
Dmitriano
Asked: 2025-01-24 19:22:58 +0800 CST

在 Docker 容器中运行 ejabberd

  • 5

在我的 Ubuntu 24.04 上,我创建了一个实验性的 Docker 文件,用于安装ejabberd:

FROM ubuntu:24.04

RUN apt update
RUN apt -y install apt-utils
RUN apt -y install locales
RUN apt -y install nano

# Set the locale
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

RUN apt -y install openssl

RUN apt -y install ejabberd

构建并运行

sudo docker build -t u24jabber .
sudo docker run -it --rm --name jabber -p 5280:5280 -p 5222:5222 -p 5269:5269 u24jabber

然后在docker容器内运行

ejabberdctl status

并收到以下错误:

Failed RPC connection to the node ejabberd@localhost: nodedown

我的第一个猜测是ejabberd没有运行,我尝试过

ejabberdctl start

在docker容器里面,但是没有帮助。

我也尝试添加

CMD ["ejabberdctl", "foreground"]

到Docker 文件,但没有成功并且telnet 172.17.0.2 5280没有连接。

ejabberd在默认配置下运行的最小 Dockerfile 是什么?

ubuntu
  • 1 个回答
  • 51 Views
Martin Hope
Dmitriano
Asked: 2025-01-20 23:40:02 +0800 CST

提交 MySQL docker 容器后,我的测试数据库消失了

  • 5

我在docker容器中运行MySQL:

sudo docker run --rm --name mysql5 --net legacy_net --net-alias mysql5 --ip 172.20.0.2 -e MYSQL_ROOT_PASSWORD=$MROOTPASS -d mysql:5.7
mysql -u root -h 172.20.0.2 -p$MROOTPASS

并使用以下命令创建了一个实验数据库:

CREATE DATABASE testdb;

并提交了容器:

sudo docker commit mysql5 mysql:5.7-test

当我启动已提交的容器时:

sudo docker stop mysql5;
sudo docker run --rm --name mysql5 --net legacy_net --net-alias mysql5 --ip 172.20.0.2 -e MYSQL_ROOT_PASSWORD=$MROOTPASS -d mysql:5.7-test

我的测试数据库消失了。

这是正常行为还是我做错了什么?

我的理解是,Docker 将其数据存储在其内部存储的某个位置,当我执行此操作时,该数据会被复制到新映像中docker commit。我误解了什么?

编辑1

sudo docker inspect mysql5 | grep -i volume

        "VolumeDriver": "",
        "VolumesFrom": null,
            "Type": "volume",
            "Source": "/var/lib/docker/volumes/1f04f07e91a16e6e9aeb393af2954dd7e32e2a2b93615fb4b6924de3568951af/_data",
        "Volumes": {

sudo docker inspect mysql:5.7

        "Volumes": {
            "/var/lib/mysql": {}
        },

编辑2

mysqlDocker使用 id=999 的用户创建卷:

sudo docker run --rm --name mysql5 -v /home/dmitriano/work/mysql:/var/lib/mysql --net legacy_net --net-alias mysql5 --ip 172.20.0.2 -e MYSQL_ROOT_PASSWORD=$MROOTPASS -d mysql:5.7

ll
drwxr-xr-x 5       999 root      4096 Jan 20 19:31 mysql/

sudo docker exec -it mysql5 bash -c "id 999"
uid=999(mysql) gid=999(mysql) groups=999(mysql)

我应该在主机上用这个 999 做什么?

mysql
  • 1 个回答
  • 45 Views
Martin Hope
Dmitriano
Asked: 2025-01-20 07:52:45 +0800 CST

MySQL8 占用大量磁盘空间

  • 5

我将 11 个数据库中的 3 个从 Ubuntu 16.04 上的 MySQL 5.7.44 迁移到了 Ubuntu 24.04 上的 MySQL 8.0.40。

我的旧机器上使用的空间:

root@localhost:/var/lib/mysql# du -ha --max-depth=1
19M     ./bot
4.0K    ./private_key.pem
1.1M    ./performance_schema
48K     ./game
79M     ./master
4.0K    ./public_key.pem
4.0K    ./client-key.pem
4.0K    ./auto.cnf
5.0G    ./beauty
0       ./debian-5.7.flag
201M    ./devnote
11M     ./mysql
4.0K    ./ca.pem
8.0K    ./test
12M     ./mike1
12M     ./ibtmp1
176K    ./phpmyadmin
4.0K    ./server-cert.pem
680K    ./sys
48M     ./ib_logfile0
4.0K    ./ca-key.pem
127M    ./mike
4.0K    ./mysql_upgrade_info
4.0K    ./ib_buffer_pool
48M     ./ib_logfile1
4.0K    ./server-key.pem
186M    ./slogpost
76M     ./ibdata1
4.0K    ./client-cert.pem
41M     ./shar
5.9G    .

我的新机器上使用的空间(新数据库是、、beauty):sharslogpost

root@localhost:/var/lib/mysql# du -ha --max-depth=1
101M    ./#innodb_redo
101M    ./binlog.000161
101M    ./binlog.000069
101M    ./binlog.000008
101M    ./binlog.000095
101M    ./binlog.000082
101M    ./binlog.000047
4.0K    ./localhost.pid
4.0K    ./public_key.pem
101M    ./binlog.000075
36K     ./mysql
101M    ./binlog.000177
101M    ./binlog.000101
101M    ./binlog.000122
4.0K    ./server-key.pem
101M    ./binlog.000107
101M    ./binlog.000158
101M    ./binlog.000079
101M    ./binlog.000057
101M    ./binlog.000028
101M    ./binlog.000173
101M    ./binlog.000020
4.0K    ./binlog.index
101M    ./binlog.000112
101M    ./binlog.000121
101M    ./binlog.000139
101M    ./binlog.000142
101M    ./binlog.000152
101M    ./binlog.000060
101M    ./binlog.000136
101M    ./binlog.000010
101M    ./binlog.000045
101M    ./binlog.000077
101M    ./binlog.000125
101M    ./binlog.000168
101M    ./binlog.000169
101M    ./binlog.000119
101M    ./binlog.000007
101M    ./binlog.000176
101M    ./binlog.000127
101M    ./binlog.000066
4.0K    ./client-key.pem
101M    ./binlog.000123
101M    ./binlog.000099
101M    ./binlog.000143
101M    ./binlog.000118
4.0K    ./private_key.pem
101M    ./binlog.000070
101M    ./binlog.000145
101M    ./binlog.000030
4.0K    ./binlog.000002
19M     ./shar
4.0K    ./auto.cnf
101M    ./binlog.000116
101M    ./binlog.000160
101M    ./binlog.000156
101M    ./binlog.000148
101M    ./binlog.000097
101M    ./binlog.000043
101M    ./binlog.000140
101M    ./binlog.000042
101M    ./binlog.000063
101M    ./binlog.000015
101M    ./binlog.000050
0       ./debian-5.7.flag
101M    ./binlog.000003
101M    ./binlog.000180
8.2M    ./#ib_16384_1.dblwr
4.0K    ./binlog.000036
101M    ./binlog.000026
12M     ./ibtmp1
101M    ./binlog.000034
1.7M    ./performance_schema
16M     ./undo_002
101M    ./binlog.000023
101M    ./binlog.000071
101M    ./binlog.000033
32K     ./binlog.000038
101M    ./binlog.000011
76K     ./binlog.000039
101M    ./binlog.000110
101M    ./binlog.000017
101M    ./binlog.000012
101M    ./binlog.000032
101M    ./binlog.000165
101M    ./binlog.000086
101M    ./binlog.000157
183M    ./slogpost
2.3G    ./binlog.000133
101M    ./binlog.000056
101M    ./binlog.000019
101M    ./binlog.000022
2.3G    ./binlog.000183
101M    ./binlog.000073
101M    ./binlog.000138
101M    ./binlog.000009
101M    ./binlog.000067
101M    ./binlog.000181
101M    ./binlog.000013
101M    ./binlog.000162
101M    ./binlog.000088
101M    ./binlog.000120
101M    ./binlog.000054
101M    ./binlog.000064
8.6M    ./binlog.000035
101M    ./binlog.000085
101M    ./binlog.000144
101M    ./binlog.000091
101M    ./binlog.000061
101M    ./binlog.000141
4.0K    ./binlog.000135
101M    ./binlog.000109
101M    ./binlog.000103
101M    ./binlog.000132
101M    ./binlog.000094
101M    ./binlog.000151
101M    ./binlog.000076
101M    ./binlog.000149
101M    ./binlog.000104
101M    ./binlog.000163
101M    ./binlog.000027
101M    ./binlog.000114
116K    ./sys
101M    ./binlog.000182
8.0K    ./ib_buffer_pool
101M    ./binlog.000115
101M    ./binlog.000164
101M    ./binlog.000084
2.4G    ./beauty
101M    ./binlog.000016
101M    ./binlog.000153
101M    ./binlog.000172
101M    ./binlog.000041
101M    ./binlog.000174
101M    ./binlog.000100
8.0K    ./binlog.000185
101M    ./binlog.000113
101M    ./binlog.000046
101M    ./binlog.000178
101M    ./binlog.000124
101M    ./binlog.000074
101M    ./binlog.000105
101M    ./binlog.000179
28M     ./mysql.ibd
101M    ./binlog.000171
101M    ./binlog.000155
101M    ./binlog.000062
101M    ./binlog.000021
101M    ./binlog.000044
101M    ./binlog.000049
101M    ./binlog.000059
101M    ./binlog.000147
60K     ./binlog.000134
101M    ./binlog.000055
4.0K    ./binlog.000040
101M    ./binlog.000126
101M    ./binlog.000170
101M    ./binlog.000089
101M    ./binlog.000006
101M    ./binlog.000080
101M    ./binlog.000081
101M    ./binlog.000068
172K    ./binlog.000037
12M     ./ibdata1
101M    ./binlog.000146
101M    ./binlog.000031
101M    ./binlog.000129
101M    ./binlog.000150
4.0K    ./binlog.000001
804K    ./#innodb_temp
101M    ./binlog.000065
75M     ./binlog.000004
4.0K    ./ca-key.pem
101M    ./binlog.000025
101M    ./binlog.000108
4.0K    ./server-cert.pem
101M    ./binlog.000090
101M    ./binlog.000051
101M    ./binlog.000048
101M    ./binlog.000052
101M    ./binlog.000024
101M    ./binlog.000053
101M    ./binlog.000130
101M    ./binlog.000014
8.0K    ./binlog.000184
101M    ./binlog.000117
101M    ./binlog.000096
101M    ./binlog.000005
101M    ./binlog.000175
101M    ./binlog.000131
101M    ./binlog.000078
101M    ./binlog.000167
101M    ./binlog.000058
101M    ./binlog.000083
101M    ./binlog.000087
101M    ./binlog.000154
101M    ./binlog.000166
101M    ./binlog.000102
4.0K    ./client-cert.pem
101M    ./binlog.000128
4.0K    ./ca.pem
101M    ./binlog.000137
101M    ./binlog.000098
16M     ./undo_001
101M    ./binlog.000029
101M    ./binlog.000018
101M    ./binlog.000092
101M    ./binlog.000106
101M    ./binlog.000072
101M    ./binlog.000111
2.3G    ./binlog.000159
192K    ./#ib_16384_0.dblwr
101M    ./binlog.000093
27G     .

du -csh binlog* | tail -n 1
24G     total

beauty(旧机器上的数据库占用5.0G,因为它包含一些额外的数据)

新机器上的 11 个数据库占用 5.9G,但旧机器上的 3 个数据库占用 27G。

为什么这么多?

要备份数据库我只需执行以下操作:

mysqldump -u $MUSER -h $MHOST -p$MPASS $MDB --no-tablespaces | sed -e 's/DEFINER=[^*]*\*/\*/' > $DBDUMP

为了恢复我这样做:

tar -Oxzf $ARCHIVE_FILE $DBDUMP | mysql -u $MUSER -h $MHOST -p$MPASS $MDB
mysql
  • 1 个回答
  • 65 Views
Martin Hope
Dmitriano
Asked: 2025-01-18 11:08:57 +0800 CST

PHP8 语法错误记录在哪里?

  • 5

我在 Ubuntu 24.04 上安装了带有 PHP8 的 LEMP,并且能够托管 WordPress 网站。

我唯一无法弄清楚的是 PHP 错误记录在哪里。

例如我创建了一个 PHP 页面,但出现错误:

<?php

phpinfo1();

?>

当我打开此页面时,浏览器显示以下内容:

在此处输入图片描述

没有出现任何错误信息/var/log/php8.3-fpm.log。

我补充道

error_log = /var/log/php8-error-log.log

到/etc/php/8.3/fpm/php.ini:

在此处输入图片描述

重新启动 php-fpm 服务

sudo service php8.3-fpm restart

并打开了出现错误的页面,但文件/var/log/php8-error-log.log根本没有创建。

下面我提供了我的phpinfo():

在此处输入图片描述

nginx
  • 1 个回答
  • 46 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve