拉取minio的docker镜像:docker pull minio/minio
创建挂载目录:
[root@test data]# mkdir /mnt/data
[root@test data]# pwd
/mnt/data
[root@test data]# cd /home/app/minio/
[root@test minio]# ls
docker-compose.yaml minio.tar.gz
编写docker-compose.yaml文件:
[root@test minio]# cat docker-compose.yaml
version: '3'
services:
miniocheck:
image: minio/minio:amd64
command: server /data --console-address ":9001"
volumes:
- /mnt/data:/data # 持久化地址
ports:
- "9000:9000" # 绑定端口
- "9001:9001"
container_name: minio
restart: always
environment:
MINIO_ROOT_USER: admin # 账号
MINIO_ROOT_PASSWORD: gbase;123 #密码
command
指令中添加--console-address
参数,否则浏览器访问控制台自动跳转端口导致无法访问,查看日志可看到如下信息:
[root@test minio]# docker-compose logs -f
Attaching to minio
minio | API: http://172.24.0.2:9000 http://127.0.0.1:9000
minio |
minio | Console: http://172.24.0.2:34327 http://127.0.0.1:34327
minio |
minio | Documentation: https://docs.min.io
minio |
minio | WARNING: Console endpoint is listening on a dynamic port (34327), please use --console-address ":PORT" to choose a static port.
minio | Exiting on signal: TERMINATED
启动容器,查看容器状态:
[root@test minio]# docker-compose up -d
Creating network "minio_default" with the default driver
Creating minio ... done
[root@test minio]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a5464ecaac1b minio/minio:amd64 "/usr/bin/docker-ent…" 5 seconds ago Up 3 seconds 0.0.0.0:9000-9001->9000-9001/tcp, :::9000-9001->9000-9001/tcp minio
01f5e4eb4004 dperson/samba:latest "/sbin/tini -- /usr/…" 3 days ago Up 24 seconds (health: starting) 0.0.0.0:139->139/tcp, :::139->139/tcp, 0.0.0.0:137-138->137-138/udp, :::137-138->137-138/udp, 0.0.0.0:445->445/tcp, :::445->445/tcp samba_samba_1
[root@test minio]# docker-compose logs -f
Attaching to minio
minio | API: http://172.19.0.2:9000 http://127.0.0.1:9000
minio |
minio | Console: http://172.19.0.2:9001 http://127.0.0.1:9001
minio |
minio | Documentation: https://docs.min.io
浏览器访问控制台:
输入docker-compose.yaml
文件中自定义的账号密码:
至此,minio部署成功。