Introduction | AList文档 (nn.ci)
如果安装了Docker,请确保将其添加到系统的PATH变量中。您可以通过在终端中运行命令echo$PATH来检查这一点。输出应该包括码头工人二进制文件的路径(通常是/ usr / bin /码头工人或/ usr /地方/ bin /码头工人)。
If Docker is installed but not in your PATH variable, you can add it by modifying your shell profile file (e.g., .bashrc or .bash_profile) to include the line export PATH=$PATH:/usr/bin/docker (replace /usr/bin/docker with the correct path to the Docker binary on your system).
安装docker
Linux安装Docker完整教程 - 腾讯云开发者社区-腾讯云 (tencent.com)
查看Linux版本的命令这里推荐两种:lsb_release -a或cat /etc/redhat-release。
lsb_release -a查看效果:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
sudo yum install -y docker-ce docker-ce-cli containerd.io
安装完成
docker version
报错
Metadata Cache Created
+ sudo -E sh -c 'yum install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin'
Repository epel is listed more than once in the configuration
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-buildx-plugin-0.10.2-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-buildx-plugin-0.10.2-1.el7.x86_64.rpm is not installed
手动编辑 /etc/yum.repos.d/epel.repo 文件,删除其中重复的仓库配置。
运行以下命令,清除 yum 缓存:
sudo yum clean all
运行以下命令,更新 yum 缓存:
sudo yum makecache
如果仍然存在问题,请确保你的系统中只有一个 EPEL 仓库的配置,并重试安装 Docker。如果问题仍然存在,你可以考虑使用其他方式安装 Docker,例如通过 Docker 官方源安装。
docker使用
启动docker
sudo systemctl start docker
检验
sudo docker run hello-world
确保当前用户具有 Docker 的执行权限。将用户添加到 docker 用户组中,然后注销并重新登录。运行以下命令将用户添加到 docker 组中:
sudo usermod -aG docker $USER
root 用户的密码步骤重置它:
在 GRUB 菜单中选择第二个内核并按下 e 键进入编辑模式。
在菜单中使用箭头键找到行,以“linux16”开始,使用箭头键向右滚动到该行的结尾。
在该行的结尾添加 rd.break 并按下 Ctrl + x,进入单用户模式。
挂载根文件系统并重新挂载为读写模式:
[lighthouse@VM-24-16-centos ~]$ chroot /sysrootchroot: cannot change root directory to /sysroot: No such file or directory
运行以下命令,挂载根文件系统
remount--从新-再
sodu mount -o remount,rw /
运行以下命令,创建一个新的目录并将根文件系统挂载到该目录下
mkdir /mnt/sysroot
mount /dev/mapper/centos-root /mnt/sysroot
确认根文件系统已经被正确挂载:
ls /mnt/sysroot
如果你能够看到根文件系统中的文件和目录,说明根文件系统已经被正确挂载。此时,你可以切换到 chroot 环境:
chroot /mnt/sysroot
如果你不能使用 root 用户账户,则需要使用 sudo 命令来获取 root 用户权限。在运行 mkdir 命令时,请确保使用 sudo 命令以 root 用户身份运行,例如
sudo mkdir /mnt/sysroot
报错
这个错误消息通常是由于安装了某些不兼容的 shell 插件或别名导致的。请尝试在不同的终端或使用不同的 shell 进行操作。如果问题仍然存在,请检查你的 shell 配置文件 (例如 ~/.bashrc) 并尝试禁用或删除任何可能导致问题的插件或别名。你也可以尝试升级你的 shell 版本或重新安装 shell。
[lighthouse@VM-24-16-centos ~]$ su root
Password:
bash: __bp_precmd_invoke_cmd: command not found
重新安装 shell
查看当前系统中安装的 shell 版本:
cat /etc/shells
这将列出当前系统中安装的所有 shell 可执行文件的路径。
安装所需的 shell 版本:
根据你的系统和需要的 shell 类型,使用合适的软件包管理工具(如 yum、apt-get、brew 等)安装所需的 shell 版本。例如,在 CentOS 中安装 bash shell:
sudo yum install
或在 Ubuntu 中安装 zsh shell:
sudo apt-get install zsh
配置新 shell:
使用 chsh 命令更改默认 shell。例如,如果你想将默认 shell 更改为 zsh,则可以执行以下命令:
chsh -s /bin/zsh
然后注销并重新登录以启动新 shell。
请注意,重新安装 shell 可能会对系统中其他软件产生意外影响。在执行此操作之前,请备份重要的文件和配置,并确保你已理解可能的风险。
docker进阶
# service 命令的用法
$ sudo service docker start
# systemctl 命令的用法
$ sudo systemctl start docker
Docker 把应用程序及其依赖,打包在 image 文件里面。只有通过这个文件,才能生成 Docker 容器。image 文件可以看作是容器的模板
# 列出本机的所有 image 文件。
$ docker image ls
# 删除 image 文件
$ docker image rm [imageName]
docker image pull是抓取 image 文件的命令
docker image pull是抓取 image 文件的命令。
library/hello-world是 image 文件在仓库里面的位置,其中library是 image 默认文件组,hello-world是 image 文件的名字
$ docker image pull hello-world library/hello-world
抓取成功以后,就可以在本机看到这个 image 文件了。
$ docker image ls
现在,运行这个 image 文件。
$ docker container run hello-world
任务
[root@VM-24-16-centos ~]# docker exec -it alist ./alist admin
INFO[2023-02-25 14:56:44] reading config file: data/config.json
INFO[2023-02-25 14:56:44] load config from env with prefix: ALIST_
INFO[2023-02-25 14:56:44] init logrus...
INFO[2023-02-25 14:56:44] admin user's info:
username: admin
password: ZloBFQuk
[root@VM-24-16-centos ~]# docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest
Unable to find image 'xhofe/alist:latest' locally
latest: Pulling from xhofe/alist
c0b0d1596f27: Pull complete
9ddd91bf3da6: Pull complete
a007da60c401: Pull complete
18e627e19deb: Pull complete
a88fa53c178d: Pull complete
Digest: sha256:396d68412e6a80e9752092b7e9a2a736ddb890ff86af7d150865eb4fe2fe6636
Status: Downloaded newer image for xhofe/alist:latest
dd26419089a6f00fc363bd48079c324396be11f94007c23c12757b0325de355c