月度归档:2023年05月

docker 无法启动 mysql 容器可能的解决办法

启动 mysql:8.* 效果很好,但 mysql:5.7.* 会导致立即 100% 内存消耗,尝试通过以下方法解决。

方法1

  1. 编辑 /lib/systemd/system/containerd.service ,修改 LimitNOFILE=infinityLimitNOFILE=1048576
  2. sudo systemctl daemon-reload
  3. sudo systemctl restart containerd.service

再尝试启动 mysql 容器。

方法2

  1. 编辑 /etc/docker/daemon.json
{
    // 原有配置...
    "default-ulimits": {
        "nofile": {
            "Name": "nofile",
            "Hard": 64000,
            "Soft": 64000
        }
    }
}

2. 重启服务 systemctl restart docker

参考:https://sukbeta.github.io/docker-ulimit-configure/

打印 apk 中的信息

前提是安装了 android studio,在 linux 中,使用以下命令:

~/Android/Sdk/build-tools/33.0.2/aapt dump <app.apk>

其中,33.0.2 要改成自己实际的版本。

在manjaro/archlinux中设置dbeaver指定的java版本

找到 dbeaver 的执行位置,查看它的安装位置:

$ which dbeaver
/usr/bin/dbeaver
$ cat /usr/bin/dbeaver
export GTK_OVERLAY_SCROLLING=0
/usr/lib/dbeaver/dbeaver $@

进入 /usr/lib/dbeaver/ 目录,编辑 dbeaver.ini ,在 -vmargs 上面,添加以下内容:

-vm
/usr/lib/jvm/java-17-openjdk/bin

注意:确保已经安装了dbeaver指定的 jre/jdk 版本,并获取其目录。

docker容器的重启策略

Use a restart policy

To configure the restart policy for a container, use the --restart flag when using the docker run command. The value of the --restart flag can be any of the following:

FlagDescription
noDo not automatically restart the container. (the default)
on-failure[:max-retries]Restart the container if it exits due to an error, which manifests as a non-zero exit code. Optionally, limit the number of times the Docker daemon attempts to restart the container using the :max-retries option.
alwaysAlways restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in restart policy details)
unless-stoppedSimilar to always, except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts.

参考:https://docs.docker.com/config/containers/start-containers-automatically/