MinIO:使用容器的方式部署
使用容器的方式搭建MinIO,你需要使用到两个工具:
- podman
- docker
在这里,我是用podman
首先,你需要安装podman:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
[root@oracle1 ~]# yum list | grep podman Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast podman.x86_64 1.6.4-29.el7_9 extras podman-docker.noarch 1.6.4-29.el7_9 extras podman-remote.x86_64 1.6.4-29.el7_9 extras [root@oracle1 ~]# [root@oracle1 ~]# yum install -y podman Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. base | 3.6 kB 00:00:00 centos-ansible-29 | 3.0 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 updates/x86_64/primary_db | 11 MB 00:00:02 Resolving Dependencies --> Running transaction check ---> Package podman.x86_64 0:1.6.4-29.el7_9 will be installed --> Processing Dependency: slirp4netns >= 0.4.0-1 for package: podman-1.6.4-29.el7_9.x86_64 --> Processing Dependency: runc >= 1.0.0-57 for package: podman-1.6.4-29.el7_9.x86_64 --> Processing Dependency: containers-common >= 0.1.29-3 for package: podman-1.6.4-29.el7_9.x86_64 --> Processing Dependency: containernetworking-plugins >= 0.8.1-1 for package: podman-1.6.4-29.el7_9.x86_64 --> Processing Dependency: nftables for package: podman-1.6.4-29.el7_9.x86_64 --> Processing Dependency: fuse-overlayfs for package: podman-1.6.4-29.el7_9.x86_64 --> Processing Dependency: container-selinux for package: podman-1.6.4-29.el7_9.x86_64 --> Processing Dependency: conmon for package: podman-1.6.4-29.el7_9.x86_64 --> Running transaction check ---> Package conmon.x86_64 2:2.0.8-1.el7 will be installed ---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed ---> Package containernetworking-plugins.x86_64 0:0.8.3-3.el7.centos will be installed ---> Package containers-common.x86_64 1:0.1.40-11.el7_8 will be installed ---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed --> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64 --> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64 --> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64 ---> Package nftables.x86_64 1:0.8-14.el7 will be installed --> Processing Dependency: libnftnl.so.7(LIBNFTNL_5)(64bit) for package: 1:nftables-0.8-14.el7.x86_64 --> Processing Dependency: libnftnl.so.7()(64bit) for package: 1:nftables-0.8-14.el7.x86_64 ---> Package runc.x86_64 0:1.0.0-69.rc10.el7_9 will be installed --> Processing Dependency: criu for package: runc-1.0.0-69.rc10.el7_9.x86_64 ---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed --> Running transaction check ---> Package criu.x86_64 0:3.12-2.el7 will be installed --> Processing Dependency: libprotobuf-c.so.1(LIBPROTOBUF_C_1.0.0)(64bit) for package: criu-3.12-2.el7.x86_64 --> Processing Dependency: libprotobuf-c.so.1()(64bit) for package: criu-3.12-2.el7.x86_64 --> Processing Dependency: libnet.so.1()(64bit) for package: criu-3.12-2.el7.x86_64 ---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed ---> Package libnftnl.x86_64 0:1.0.8-3.el7 will be installed --> Running transaction check ---> Package libnet.x86_64 0:1.1.6-7.el7 will be installed ---> Package protobuf-c.x86_64 0:1.0.2-3.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================= Package Arch Version Repository Size ========================================================================================================================= Installing: podman x86_64 1.6.4-29.el7_9 extras 13 M Installing for dependencies: conmon x86_64 2:2.0.8-1.el7 extras 31 k container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k containernetworking-plugins x86_64 0.8.3-3.el7.centos extras 20 M containers-common x86_64 1:0.1.40-11.el7_8 extras 43 k criu x86_64 3.12-2.el7 base 453 k fuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 k fuse3-libs x86_64 3.6.1-4.el7 extras 82 k libnet x86_64 1.1.6-7.el7 base 59 k libnftnl x86_64 1.0.8-3.el7 base 78 k nftables x86_64 1:0.8-14.el7 base 186 k protobuf-c x86_64 1.0.2-3.el7 base 28 k runc x86_64 1.0.0-69.rc10.el7_9 extras 2.7 M slirp4netns x86_64 0.4.3-4.el7_8 extras 81 k Transaction Summary ========================================================================================================================= Install 1 Package (+13 Dependent packages) Total download size: 36 M Installed size: 141 M Downloading packages: (1/14): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:00 (2/14): conmon-2.0.8-1.el7.x86_64.rpm | 31 kB 00:00:00 (3/14): containers-common-0.1.40-11.el7_8.x86_64.rpm | 43 kB 00:00:00 (4/14): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm | 54 kB 00:00:00 (5/14): fuse3-libs-3.6.1-4.el7.x86_64.rpm | 82 kB 00:00:00 (6/14): libnet-1.1.6-7.el7.x86_64.rpm | 59 kB 00:00:00 (7/14): criu-3.12-2.el7.x86_64.rpm | 453 kB 00:00:00 (8/14): nftables-0.8-14.el7.x86_64.rpm | 186 kB 00:00:00 (9/14): libnftnl-1.0.8-3.el7.x86_64.rpm | 78 kB 00:00:00 (10/14): protobuf-c-1.0.2-3.el7.x86_64.rpm | 28 kB 00:00:00 (11/14): podman-1.6.4-29.el7_9.x86_64.rpm | 13 MB 00:00:04 (12/14): runc-1.0.0-69.rc10.el7_9.x86_64.rpm | 2.7 MB 00:00:01 (13/14): slirp4netns-0.4.3-4.el7_8.x86_64.rpm | 81 kB 00:00:00 (14/14): containernetworking-plugins-0.8.3-3.el7.centos.x86_64.rpm | 20 MB 00:00:06 ------------------------------------------------------------------------------------------------------------------------- Total 5.3 MB/s | 36 MB 00:00:06 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 1/14 setsebool: SELinux is disabled. Installing : slirp4netns-0.4.3-4.el7_8.x86_64 2/14 Installing : containernetworking-plugins-0.8.3-3.el7.centos.x86_64 3/14 Installing : libnftnl-1.0.8-3.el7.x86_64 4/14 Installing : 1:nftables-0.8-14.el7.x86_64 5/14 Installing : 2:conmon-2.0.8-1.el7.x86_64 6/14 Installing : fuse3-libs-3.6.1-4.el7.x86_64 7/14 Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64 8/14 Installing : 1:containers-common-0.1.40-11.el7_8.x86_64 9/14 Installing : protobuf-c-1.0.2-3.el7.x86_64 10/14 Installing : libnet-1.1.6-7.el7.x86_64 11/14 Installing : criu-3.12-2.el7.x86_64 12/14 Installing : runc-1.0.0-69.rc10.el7_9.x86_64 13/14 Installing : podman-1.6.4-29.el7_9.x86_64 14/14 Verifying : libnet-1.1.6-7.el7.x86_64 1/14 Verifying : protobuf-c-1.0.2-3.el7.x86_64 2/14 Verifying : fuse3-libs-3.6.1-4.el7.x86_64 3/14 Verifying : podman-1.6.4-29.el7_9.x86_64 4/14 Verifying : fuse-overlayfs-0.7.2-6.el7_8.x86_64 5/14 Verifying : runc-1.0.0-69.rc10.el7_9.x86_64 6/14 Verifying : slirp4netns-0.4.3-4.el7_8.x86_64 7/14 Verifying : 1:nftables-0.8-14.el7.x86_64 8/14 Verifying : criu-3.12-2.el7.x86_64 9/14 Verifying : 2:conmon-2.0.8-1.el7.x86_64 10/14 Verifying : 1:containers-common-0.1.40-11.el7_8.x86_64 11/14 Verifying : libnftnl-1.0.8-3.el7.x86_64 12/14 Verifying : containernetworking-plugins-0.8.3-3.el7.centos.x86_64 13/14 Verifying : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 14/14 Installed: podman.x86_64 0:1.6.4-29.el7_9 Dependency Installed: conmon.x86_64 2:2.0.8-1.el7 container-selinux.noarch 2:2.119.2-1.911c772.el7_8 containernetworking-plugins.x86_64 0:0.8.3-3.el7.centos containers-common.x86_64 1:0.1.40-11.el7_8 criu.x86_64 0:3.12-2.el7 fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 fuse3-libs.x86_64 0:3.6.1-4.el7 libnet.x86_64 0:1.1.6-7.el7 libnftnl.x86_64 0:1.0.8-3.el7 nftables.x86_64 1:0.8-14.el7 protobuf-c.x86_64 0:1.0.2-3.el7 runc.x86_64 0:1.0.0-69.rc10.el7_9 slirp4netns.x86_64 0:0.4.3-4.el7_8 Complete! [root@oracle1 ~]# |
然后,创建给MinIO使用的路径:
1 2 3 4 5 6 7 8 9 |
[root@oracle1 ~]# mkdir -p /minio/{data,config} [root@oracle1 ~]# [root@oracle1 ~]# tree /minio/ /minio/ ├── config └── data 2 directories, 0 files [root@oracle1 ~]# |
拉取MinIO的容器镜像:
如果使用的是docker:
1 |
docker pull minio/minio |
如果使用的是podman:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@oracle1 ~]# podman pull minio/minio Trying to pull registry.access.redhat.com/minio/minio... name unknown: Repo not found Trying to pull registry.redhat.io/minio/minio... unable to retrieve auth token: invalid username/password: unauthorized: Please login to the Red Hat Registry using your Customer Portal credentials. Further instructions can be found here: https://access.redhat.com/RegistryAuthentication Trying to pull docker.io/minio/minio... Getting image source signatures Copying blob 7b4b68819f97 done Copying blob dde93efae2ff done Copying blob ebe99df2478d done Copying blob 10ba3bdbb375 done Copying blob 94249d6f79d2 done Copying blob c8b19a9e0404 done Copying blob 543357f7a3a0 done Copying config c40e60ad48 done Writing manifest to image destination Storing signatures c40e60ad48538d7393b2230cb45ba68941be4670e09f39a715d87031b0992064 [root@oracle1 ~]# |
可以从上面的命令反馈看到,最后是从【docker.io/minio/minio】下载到的MinIO
继续下一步之前,先看看podman的帮助信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
[root@oracle1 ~]# podman -h manage pods and images Usage: podman [flags] podman [command] Available Commands: attach Attach to a running container build Build an image using instructions from Containerfiles commit Create new image based on the changed container container Manage Containers cp Copy files/folders between a container and the local filesystem create Create but do not start a container diff Inspect changes on container's file systems events Show podman events exec Run a process in a running container export Export container's filesystem contents as a tar archive generate Generated structured data healthcheck Manage Healthcheck help Help about any command history Show history of a specified image image Manage images images List images in local storage import Import a tarball to create a filesystem image info Display podman system information init Initialize one or more containers inspect Display the configuration of a container or image kill Kill one or more running containers with a specific signal load Load an image from container archive login Login to a container registry logout Logout of a container registry logs Fetch the logs of a container mount Mount a working container's root filesystem network Manage Networks pause Pause all the processes in one or more containers play Play a pod pod Manage pods port List port mappings or a specific mapping for the container ps List containers pull Pull an image from a registry push Push an image to a specified destination restart Restart one or more containers rm Remove one or more containers rmi Removes one or more images from local storage run Run a command in a new container save Save image to an archive search Search registry for image start Start one or more containers stats Display a live stream of container resource usage statistics stop Stop one or more containers system Manage podman tag Add an additional name to a local image top Display the running processes of a container umount Unmounts working container's root filesystem unpause Unpause the processes in one or more containers unshare Run a command in a modified user namespace varlink Run varlink interface version Display the Podman Version Information volume Manage volumes wait Block on one or more containers Flags: --cgroup-manager string Cgroup manager to use (cgroupfs or systemd) (default "systemd") --cni-config-dir string Path of the configuration directory for CNI networks --config string Path of a libpod config file detailing container server configuration options --conmon string Path of the conmon binary --cpu-profile string Path for the cpu profiling results --events-backend string Events backend to use --help Help for podman --hooks-dir strings Set the OCI hooks directory path (may be set multiple times) --log-level string Log messages above specified level: debug, info, warn, error, fatal or panic (default "error") --namespace string Set the libpod namespace, used to create separate views of the containers and pods on the system --network-cmd-path string Path to the command for configuring the network --root string Path to the root directory in which data, including images, is stored --runroot string Path to the 'run directory' where all state information is stored --runtime string Path to the OCI-compatible binary used to run containers, default is /usr/bin/runc --storage-driver string Select which storage driver is used to manage storage of images and containers (default is overlay) --storage-opt stringArray Used to pass an option to the storage driver --syslog Output logging information to syslog as well as the console --tmpdir string Path to the tmp directory --trace Enable opentracing output -v, --version Version of podman Use "podman [command] --help" for more information about a command. [root@oracle1 ~]# [root@oracle1 ~]# podman -h | grep -i display info Display podman system information inspect Display the configuration of a container or image stats Display a live stream of container resource usage statistics top Display the running processes of a container version Display the Podman Version Information [root@oracle1 ~]# [root@oracle1 ~]# podman -h | grep -i list images List images in local storage port List port mappings or a specific mapping for the container ps List containers [root@oracle1 ~]# |
查看一下podman当前的状态:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
[root@oracle1 ~]# podman info host: BuildahVersion: 1.11.5 CgroupVersion: v1 Conmon: package: conmon-2.0.8-1.el7.x86_64 path: /usr/bin/conmon version: 'conmon version 2.0.8, commit: f85c8b1ce77b73bcd48b2d802396321217008762' Distribution: distribution: '"rhel"' version: "7.6" MemFree: 270241792 MemTotal: 3954188288 OCIRuntime: name: runc package: runc-1.0.0-69.rc10.el7_9.x86_64 path: /usr/bin/runc version: 'runc version spec: 1.0.1-dev' SwapFree: 2126413824 SwapTotal: 2147479552 arch: amd64 cpus: 2 eventlogger: journald hostname: oracle1 kernel: 3.10.0-957.el7.x86_64 os: linux rootless: false uptime: 65h 17m 1.17s (Approximately 2.71 days) registries: blocked: null insecure: null search: - registry.access.redhat.com - registry.redhat.io - docker.io store: ConfigFile: /etc/containers/storage.conf ContainerStore: number: 0 GraphDriverName: overlay GraphOptions: {} GraphRoot: /var/lib/containers/storage GraphStatus: Backing Filesystem: xfs Native Overlay Diff: "true" Supports d_type: "true" Using metacopy: "false" ImageStore: number: 1 RunRoot: /var/run/containers/storage VolumePath: /var/lib/containers/storage/volumes [root@oracle1 ~]# [root@oracle1 ~]# podman images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/minio/minio latest c40e60ad4853 17 hours ago 262 MB [root@oracle1 ~]# [root@oracle1 ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [root@oracle1 ~]# |
运行:MinIO
命令:
1 2 3 4 5 6 7 8 9 |
podman run \ --name minio \ -p 9005:9005 \ -p 9006:9006 \ -e "MINIO_ROOT_USER=admin" \ -e "MINIO_ROOT_PASSWORD=admin123" \ -v /minio/data:/data \ -v /minio/config:/root/.minio \ -d minio/minio server /data --console-address ":9006" --address ":9005" |
运行过程:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
[root@oracle1 ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES [root@oracle1 ~]# [root@oracle1 ~]# podman run \ > --name minio \ > -p 9005:9005 \ > -p 9006:9006 \ > -e "MINIO_ROOT_USER=admin" \ > -e "MINIO_ROOT_PASSWORD=admin123" \ > -v /minio/data:/data \ > -v /minio/config:/root/.minio \ > -d minio/minio server /data --console-address ":9006" --address ":9005" a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047 [root@oracle1 ~]# [root@oracle1 ~]# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a6053b83bdd4 docker.io/minio/minio:latest server /data --co... 4 seconds ago Up 3 seconds ago 0.0.0.0:9005-9006->9005-9006/tcp minio [root@oracle1 ~]# |
查看端口状态:
1 2 3 4 5 6 7 8 |
[root@oracle1 ~]# ps -ef | grep podman root 12729 1 0 07:48 ? 00:00:00 /usr/bin/conmon --api-version 1 -s -c a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047 -u a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047 -r /usr/bin/runc -b /var/lib/containers/storage/overlay-containers/a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047/userdata -p /var/run/containers/storage/overlay-containers/a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047/userdata/pidfile -l k8s-file:/var/lib/containers/storage/overlay-containers/a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047/userdata/ctr.log --exit-dir /var/run/libpod/exits --socket-dir-path /var/run/libpod/socket --log-level error --runtime-arg --log-format=json --runtime-arg --log --runtime-arg=/var/run/containers/storage/overlay-containers/a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047/userdata/oci-log --conmon-pidfile /var/run/containers/storage/overlay-containers/a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047/userdata/conmon.pid --exit-command /usr/bin/podman --exit-command-arg --root --exit-command-arg /var/lib/containers/storage --exit-command-arg --runroot --exit-command-arg /var/run/containers/storage --exit-command-arg --log-level --exit-command-arg error --exit-command-arg --cgroup-manager --exit-command-arg systemd --exit-command-arg --tmpdir --exit-command-arg /var/run/libpod --exit-command-arg --runtime --exit-command-arg runc --exit-command-arg --storage-driver --exit-command-arg overlay --exit-command-arg --events-backend --exit-command-arg journald --exit-command-arg container --exit-command-arg cleanup --exit-command-arg a6053b83bdd4b2a9de33780a63f7a6b573d06522f387241abec2695955b53047 root 12874 125389 0 07:50 pts/1 00:00:00 grep --color=auto podman [root@oracle1 ~]# [root@oracle1 ~]# netstat -tupln | grep conmon tcp 0 0 0.0.0.0:9005 0.0.0.0:* LISTEN 12729/conmon tcp 0 0 0.0.0.0:9006 0.0.0.0:* LISTEN 12729/conmon [root@oracle1 ~]# |
查看启动日志:
1 2 3 4 5 6 7 |
[root@oracle1 ~]# podman logs minio API: http://10.88.0.2:9005 http://127.0.0.1:9005 Console: http://10.88.0.2:9006 http://127.0.0.1:9006 Documentation: https://docs.min.io [root@oracle1 ~]# |
如果是docker:
1 |
docker logs minio |
浏览器访问:
http://192.168.11.11:9006/login


MinIO Client
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@oracle1 upload]# podman run --name my-mc --hostname oracle1 -it --entrypoint /bin/bash --rm minio/mc Trying to pull registry.access.redhat.com/minio/mc... name unknown: Repo not found Trying to pull registry.redhat.io/minio/mc... unable to retrieve auth token: invalid username/password: unauthorized: Please login to the Red Hat Registry using your Customer Portal credentials. Further instructions can be found here: https://access.redhat.com/RegistryAuthentication Trying to pull docker.io/minio/mc... Getting image source signatures Copying blob 697e57db2002 done Copying blob 8f403cb21126 done Copying blob d8a81aa4d9ba done Copying blob dcb8b43035f1 done Copying blob 65c0f2178ac8 done Copying config 181866aacc done Writing manifest to image destination Storing signatures [root@oracle1 /]# |
这样,用容器方式运行的MinIO就部署好了。