共计 1421 个字符,预计需要花费 4 分钟才能阅读完成。
装置 Nginx
Dockerhub 官网: https://hub.docker.com/_/nginx
docker pull nginx
docker run -d --name nginx01 -p 3344:80 nginx
-d #后盾运行
--name #容器命名
-p 宿主机端口: 容器外部端口 #配置端口
查看容器
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7c5fb92ea7f nginx "/docker-entrypoint.…" 9 seconds ago Up 8 seconds 0.0.0.0:3344->80/tcp, :::3344->80/tcp nginx01
测试拜访
curl localhost:3344
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
...
进入容器
docker exec -it nginx01 /bin/bash
whereis nginx
cat /etc/nginx/conf.d/default.conf
进行容器
docker stop e7c5fb92ea7f
装置 Elasticsearch
docker run -d --name es01 -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx512m" elasticsearch:7.13.4
启动测试
curl localhost:9200
{
"name" : "3fd55120f117",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "S6dFIP9US120-499yDVUGA",
"version" : {
"number" : "7.13.4",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "c5f60e894ca0c61cdbae4f5a686d9f08bcefc942",
"build_date" : "2021-07-14T18:33:36.673943207Z",
"build_snapshot" : false,
"lucene_version" : "8.8.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
查看内容占用
docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
3fd55120f117 es01 0.32% 413.4MiB / 1.795GiB 22.49% 1.74kB / 2.54kB 20.3MB / 1.26MB 47
装置 portainer
1. 装置
docker run -d -p 8088:9000 \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
--privileged=true \
portainer/portainer
2. 测试拜访
http://xxx.com:8088
3. 新建 admin 用户
4. 抉择 Local
正文完