安装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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。