18年搞了一阵docker,当时模糊的使用,现在竟然忘得干干净净。。。。
1,docker的基本概念
镜像 Image,类似于一个已经部署好的系统的一个压缩文件;
容器 Container,镜像解压开就可以运行,运行的时候就是容器,是镜像运行时的实体;
仓库 类似于bintray,maven之类的,存放各种制作好的镜像。https://hub.docker.com/
2,ubuntu使用官方脚本自动安装
$ curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# Executing docker install script, commit: 3d8fe77c2c46c5b7571f94b42793905e5b3e42e4
+ sudo -E sh -c 'apt-get update -qq >/dev/null'
+ sudo -E sh -c 'DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl gnupg >/dev/null'
+ sudo -E sh -c 'curl -fsSL "https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null'
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sudo -E sh -c 'echo "deb [arch=arm64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list'
+ sudo -E sh -c 'apt-get update -qq >/dev/null'
+ '[' -n '' ']'
+ sudo -E sh -c 'apt-get install -y -qq --no-install-recommends docker-ce >/dev/null'
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
$
想到了昔日被Ubuntu依赖支配的恐惧。。。。
root@localhost:/home/senrsl# apt-get update
获取:1 http://mirror.tuna.tsinghua.edu.cn/ubuntu-ports bionic InRelease [242 kB]
命中:2 https://download.docker.com/linux/ubuntu bionic InRelease
已下载 242 kB,耗时 1秒 (226 kB/s)
正在读取软件包列表... 完成
W: 目标 Packages (stable/binary-all/Packages) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
W: 目标 Translations (stable/i18n/Translation-zh_CN) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
W: 目标 Translations (stable/i18n/Translation-zh) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
W: 目标 Translations (stable/i18n/Translation-en) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
W: 目标 Packages (stable/binary-all/Packages) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
W: 目标 Translations (stable/i18n/Translation-zh_CN) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
W: 目标 Translations (stable/i18n/Translation-zh) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
W: 目标 Translations (stable/i18n/Translation-en) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
root@localhost:/home/senrsl# vi /etc/apt/sources.list
注释重复
root@localhost:/home/senrsl# apt-get update
命中:1 https://download.docker.com/linux/ubuntu bionic InRelease
正在读取软件包列表... 完成
root@localhost:/home/senrsl#
这个问题呀。。。。
3,centos7 安装jdk
省事的来,直接上yum
-sh-4.2$ yum search jdk
[root@localhost senrsl]# yum install java-1.8.0-openjdk.aarch64
[root@localhost senrsl]# java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
[root@localhost senrsl]#
多简单。。。。
4,安装Tomcat
[root@localhost senrsl]# curl -O https://ftp.wayne.edu/apache/tomcat/tomcat-10/v10.0.2/bin/apache-tomcat-10.0.2.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.8M 100 10.8M 0 0 674k 0 0:00:16 0:00:16 --:--:-- 1334k
[root@localhost senrsl]# ls
apache-tomcat-10.0.2.tar.gz
[root@localhost senrsl]# tar -zxvf apache-tomcat-10.0.2.tar.gz
apache-tomcat-10.0.2/conf/
5,部署clock到主页
同前
6,centos 安 docker
[root@localhost senrsl]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# Executing docker install script, commit: 3d8fe77c2c46c5b7571f94b42793905e5b3e42e4
+ sh -c 'yum install -y -q yum-utils'
软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本
+ sh -c 'yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo'
已加载插件:fastestmirror
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache'
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
base | 3.6 kB 00:00:00
centos-7-aarch64 | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/12): base/7/aarch64/filelists_db | 6.2 MB 00:00:03
(2/12): docker-ce-stable/7/aarch64/fi。。。
+ sh -c 'yum install -y -q docker-ce'
warning: /var/cache/yum/aarch64/7/docker-ce-stable/packages/docker-ce-20.10.5-3.el7.aarch64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
docker-ce-20.10.5-3.el7.aarch64.rpm 的公钥尚未安装
导入 GPG key 0x621E9F35:
用户ID : "Docker Release (CE rpm) <docker@docker.com>"
指纹 : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
来自 : https://download.docker.com/linux/centos/gpg
setsebool: SELinux is disabled.
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.
[root@localhost senrsl]# docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
[root@localhost senrsl]# systemctl status docker
Running in chroot, ignoring request.
[root@localhost senrsl]#
看起来虽然安装了,但是安的有问题?
[root@localhost senrsl]# docker --help
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
Options:
--config string Location of client config files (default "/root/.docker")
-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with
"docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
Management Commands:
app* Docker App (Docker Inc., v0.9.1-beta3)
builder Manage builds
buildx* Build with BuildKit (Docker Inc., v0.5.1-docker)
config Manage Docker configs
container Manage containers
context Manage contexts
image Manage images
manifest Manage Docker image manifests and manifest lists
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes
Commands:
attach Attach local standard input, output, and error streams to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes
Run 'docker COMMAND --help' for more information on a command.
To get more help with docker, check out our guides at https://docs.docker.com/go/guides/
[root@localhost senrsl]# docker stats
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost senrsl]#
启动试试
[root@localhost senrsl]# dockerd
INFO[2021-03-05T19:09:53.785755774+08:00] Starting up
INFO[2021-03-05T19:09:53.815427024+08:00] libcontainerd: started new containerd process pid=29674
INFO[2021-03-05T19:09:53.815789399+08:00] parsed scheme: "unix" module=grpc
INFO[2021-03-05T19:09:53.815913274+08:00] scheme "unix" not registered, fallback to default scheme module=grpc
INFO[2021-03-05T19:09:53.816107274+08:00] ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>} module=grpc
。。。INFO[2021-03-05T19:09:54.551019232+08:00] ClientConn switching balancer to "pick_first" module=grpc
ERRO[2021-03-05T19:09:54.559654982+08:00] failed to mount overlay: no such device storage-driver=overlay2
ERRO[2021-03-05T19:09:54.572691066+08:00] AUFS was not found in /proc/filesystems storage-driver=aufs
ERRO[2021-03-05T19:09:54.575922982+08:00] failed to mount overlay: no such device storage-driver=overlay
ERRO[2021-03-05T19:09:54.589914566+08:00] Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a more recent version of libdevmapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/dockerd/#storage-driver-options storage-driver=devicemapper
WARN[2021-03-05T19:09:54.688821608+08:00] Your kernel does not support cgroup memory limit
WARN[2021-03-05T19:09:54.688962358+08:00] Unable to find cpu cgroup in mounts
WARN[2021-03-05T19:09:54.689017066+08:00] Unable to find blkio cgroup in mounts
WARN[2021-03-05T19:09:54.689055983+08:00] Unable to find cpuset cgroup in mounts
WARN[2021-03-05T19:09:54.689095691+08:00] Unable to find pids cgroup in mounts
INFO[2021-03-05T19:09:54.691298608+08:00] stopping healthcheck following graceful shutdown module=libcontainerd
INFO[2021-03-05T19:09:54.691382316+08:00] stopping event stream following graceful shutdown error="context canceled" module=libcontainerd namespace=plugins.moby
WARN[2021-03-05T19:09:55.693371525+08:00] grpc: addrConn.createTransport failed to connect to {unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}. Err :connection error: desc = "transport: Error while dialing dial unix:///var/run/docker/containerd/containerd.sock: timeout". Reconnecting... module=grpc
failed to start daemon: Devices cgroup isn't mounted
[root@localhost senrsl]# service docker staus
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@localhost senrsl]# service docker status
Redirecting to /bin/systemctl status docker.service
Running in chroot, ignoring request.
[root@localhost senrsl]#
[root@localhost senrsl]# docker --version
Docker version 20.10.5, build 55c4c88
[root@localhost senrsl]#
查了下,据说是 因为 LinuxDeploy本身是个容器,不能在容器中安装容器。。。。。
然后
[root@localhost senrsl]# yum list installed | grep docker
containerd.io.aarch64 1.4.3-3.1.el7 @docker-ce-stable
docker-ce.aarch64 3:20.10.5-3.el7 @docker-ce-stable
docker-ce-cli.aarch64 1:20.10.5-3.el7 @docker-ce-stable
docker-ce-rootless-extras.aarch64
20.10.5-3.el7 @docker-ce-stable
[root@localhost senrsl]# yum remove containerd.io.aarch64
已加载插件:fastestmirror。。。
完毕!
[root@localhost senrsl]# yum -y remove docker-ce-cli.aarch64。。。
完毕!
[root@localhost senrsl]# yum -y remove docker-ce-rootless-extras.aarch64
已加载插件:fastestmirror
参数 docker-ce-rootless-extras.aarch64 没有匹配
不删除任何软件包
[root@localhost senrsl]# yum list installed | grep docker
[root@localhost senrsl]#
干的漂亮.jpg....
7,既然如此,那就布到 centos服务器上吧。。。。
senRsl
2021年03月04日17:14:35
没有评论 :
发表评论