在前面“MinIO 简单使用”章节中,简单介绍了 MinIO 的使用。
本章节将介绍怎样使用 Docker 容器安装 MinIO,并运行 MinIO和进行访问。
执行下面 docker 命令去安装稳定版本的 minio。命令如下:
[root@localhost ~]# docker pull minio/minio Using default tag: latest latest: Pulling from minio/minio 8f403cb21126: Pull complete 65c0f2178ac8: Pull complete 71a67c7a3476: Pull complete 84635ce83d3f: Pull complete 4fb2761cbbc2: Pull complete bf3568dc9625: Pull complete 2d431c3d90d0: Pull complete Digest: sha256:195edc11c6f8d03af951dce9f3b5fbe9192a646131d67a128224d421d78f3853 Status: Downloaded newer image for minio/minio:latest [root@localhost ~]# docker images | grep minio minio/minio latest 968dc6c98a3e 2 weeks ago 296MB
运行 minio 镜像,命令如下:
# 创建存放数据的目录 [root@localhost ~]# mkdir data # 运行 minio 服务 [root@localhost ~]# docker run -p 9000:9000 minio/minio server /root/data No credential environment variables defined. Going with the defaults. It is strongly recommended to define your own credentials via environment variables MINIO_ROOT_USER and MINIO_ROOT_PASSWORD instead of using default values Endpoint: http://172.17.0.2:9000 http://127.0.0.1:9000 Browser Access: http://172.17.0.2:9000 http://127.0.0.1:9000 Object API (Amazon S3 compatible): Go: https://docs.min.io/docs/golang-client-quickstart-guide Java: https://docs.min.io/docs/java-client-quickstart-guide Python: https://docs.min.io/docs/python-client-quickstart-guide JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide .NET: https://docs.min.io/docs/dotnet-client-quickstart-guide Detected default credentials 'minioadmin:minioadmin', please change the credentials immediately by setting 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment values IAM initialization complete
使用浏览器访问(Access Key 和 Secret Key 均为 minioadmin),如下图:
运行 docker pull 命令,下载 minio 尝鲜版本的 docker 镜像。命令如下:
[root@localhost ~]# docker pull minio/minio:edge edge: Pulling from minio/minio 8f403cb21126: Already exists 65c0f2178ac8: Already exists 71a67c7a3476: Already exists 84635ce83d3f: Already exists 4fb2761cbbc2: Already exists bf3568dc9625: Already exists 2d431c3d90d0: Already exists Digest: sha256:e2990b3099657a69d038c752b664803663ab5522f65d1139bd4189cf87f38ee8 Status: Downloaded newer image for minio/minio:edge [root@localhost ~]# docker images | grep minio minio/minio edge 8cfcaa5e5e5f 2 weeks ago 296MB
使用 docker run 命令运行 minio 尝鲜版,命令如下:
[root@localhost ~]# docker run -p 9000:9000 minio/minio:edge server /root/data No credential environment variables defined. Going with the defaults. It is strongly recommended to define your own credentials via environment variables MINIO_ROOT_USER and MINIO_ROOT_PASSWORD instead of using default values Endpoint: http://172.17.0.2:9000 http://127.0.0.1:9000 Browser Access: http://172.17.0.2:9000 http://127.0.0.1:9000 Object API (Amazon S3 compatible): Go: https://docs.min.io/docs/golang-client-quickstart-guide Java: https://docs.min.io/docs/java-client-quickstart-guide Python: https://docs.min.io/docs/python-client-quickstart-guide JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide .NET: https://docs.min.io/docs/dotnet-client-quickstart-guide Detected default credentials 'minioadmin:minioadmin', please change the credentials immediately by setting 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment values IAM initialization complete
使用浏览器访问(Access Key 和 Secret Key 均为 minioadmin),如下图:
成功安装成功 MinIO 后,我们可以开始使用 MinIO 保存我们的文件了。下面是一个简单示例: