【通过docker安装常用软件镜像】1.镜像 2.安装 redis,jdk,nginx

1)官网镜像网站

hello-world - Official Image | Docker Hub

2)安装镜像测试例子

Redis

1.查询redis

[root@localhost ~]# docker search redis
NAME                                DESCRIPTION                                     STARS     OFFICIAL
redis                               Redis is an open source key-value store that…   12620     [OK]
redislabs/redisearch                Redis With the RedisSearch module pre-loaded…   61
redislabs/redisinsight              RedisInsight - The GUI for Redis                95
redis/redis-stack-server            redis-stack-server installs a Redis server w…   65
redis/redis-stack                   redis-stack installs a Redis server with add…   91
redislabs/rebloom                   A probablistic datatypes module for Redis       25
redislabs/redis                     Clustered in-memory database engine compatib…   40
redislabs/rejson                    RedisJSON - Enhanced JSON data type processi…   53
redislabs/redisgraph                A graph database module for Redis               26
redislabs/redismod                  An automated build of redismod - latest Redi…   44
redislabs/redistimeseries           A time series database module for Redis         12
redislabs/operator                                                                  7
redislabs/operator-internal         This repository contains pre-released versio…   1
redislabs/redis-py                                                                  5
redislabs/redis-webcli              A tiny Flask app to provide access to Redis …   5
redislabs/redisgears                An automated build of RedisGears                4
redislabs/k8s-controller-internal                                                   0
redislabs/memtier_benchmark         Docker image to run memtier_benchmark           0
redislabs/k8s-controller                                                            2
redislabs/ng-redis-raft             Redis with redis raft module                    0
redislabs/redisai                                                                   6
redislabs/olmtest                   Test artefact for OLM CSV                       1
redislabs/olm-bundle                                                                0
bitnami/redis                       Bitnami Redis Docker Image                      272
redislabs/redisml                   A Redis module that implements several machi…   3

2.下载redis软件

[root@localhost ~]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
2f44b7a888fa: Pull complete
c55535369ffc: Pull complete
3622841bf0aa: Pull complete
91a62ca7377a: Pull complete
fdd219d1f4ab: Pull complete
fdf07fe2fb4c: Pull complete
4f4fb700ef54: Pull complete
fba604e70bfe: Pull complete
Digest: sha256:b5ddcd52d425a8e354696c022f392fe45fca928f68d6289e6bb4a709c3a74668
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest

3.查看下当前的进程

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

4.运行redis

[root@localhost ~]# docker run -p 6379:6379 -v $PWD/data:/data  -d redis redis-server --appendonly yes
44f4cc75e904c13684797b65363161aed90c276e025d9d02f07ea9d3e55ced6c

5.再查看下,可以看出redis运行起来了

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS                                       NAMES
44f4cc75e904   redis     "docker-entrypoint.s…"   8 seconds ago   Up 3 seconds   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp   adoring_cray

6.我们停止redis,再次查看

[root@localhost ~]# docker stop 681cca6e0de3
681cca6e0de3
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

发现redis已经停止成功了。

JDK11

安装

docker  pull  openjdk:11

运行

[root@localhost ~]# docker run -d -t --name java-11 openjdk:11
dec7ebdda93506b8bd126775cae08e05ee682a2456ffc1276c0a9575da9ca94e

查看进程

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE        COMMAND    CREATED          STATUS         PORTS     NAMES
dec7ebdda935   openjdk:11   "jshell"   11 seconds ago   Up 4 seconds             java-11

Nginx

下载

docker pull nginx

运行

 docker run -d -t --name mynginx nginx

你可能感兴趣的:(#,docker,docker,redis,容器)