0

I have use the Ubuntu Virtualbox.

Docker version : Docker version 20.10.12, build e91ed57

redis version: 3.0

From Ubuntu, I'm trying to initialize and connect to redis-vm server. I have use following docker commands to build, create container and connect with the redis-server.

(base) root@adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker build --rm -f ./Dockerfile --tag redis:3.0 .

Sending build context to Docker daemon  1.571MB
Step 1/26 : FROM alpine:20210804 as redis-dev
 ---> 4e873038b87b
Step 2/26 : ENV REDIS_VERS "6.2.6"
 ---> Using cache
 ---> bd2bd3468229
Step 3/26 : ENV REDIS_REPO "https://github.com/redis/redis.git"
 ---> Using cache
 ---> 51831b501b6d
Step 4/26 : ENV REDISJSON_VERS "2.0.6"
 ---> Using cache
 ---> c9fbf3a205bc
Step 5/26 : ENV REDISJSON_REPO "https://github.com/RedisJSON/RedisJSON.git"
 ---> Using cache
 ---> a4d2767081c9
Step 6/26 : RUN apk add --no-cache coreutils gcc g++ cargo linux-headers make musl-dev git     rust cargo clang-libs pkgconf
 ---> Using cache
 ---> a603a024df55
Step 7/26 : RUN git clone --depth 1 --branch ${REDIS_VERS} ${REDIS_REPO} redis &&     cd /redis &&     make -j "$(nproc)" &&     make install
 ---> Using cache
 ---> b784b1ea27e4
Step 8/26 : FROM alpine:3.14
 ---> dd53f409bf0b
Step 9/26 : RUN sed -i 's/https/http/' /etc/apk/repositories
 ---> Using cache
 ---> d5f72fd3c94e
Step 10/26 : RUN apk update && apk add bash
 ---> Using cache
 ---> fe89e27870d6
Step 11/26 : RUN apk add libgcc
 ---> Using cache
 ---> d4f8dec09ec0
Step 12/26 : RUN apk add --no-cache python3
 ---> Using cache
 ---> 558f61bd0567
Step 13/26 : RUN apk add --no-cache py3-pip
 ---> Using cache
 ---> f21fc80a1225
Step 14/26 : RUN pip3 install redis
 ---> Using cache
 ---> 634aae092977
Step 15/26 : RUN pip3 install pytest
 ---> Using cache
 ---> f03644be4ca8
Step 16/26 : COPY sysvar-py/ /sysvar-py/
 ---> Using cache
 ---> ca867b2bbc2e
Step 17/26 : ENV REDIS_URL=redis://localhost:6379
 ---> Using cache
 ---> 8e4ece4479d3
Step 18/26 : COPY startup/ /startup/
 ---> Using cache
 ---> fefed1c53dee
Step 19/26 : COPY --from=redis-dev /usr/local/bin/redis-* /usr/local/bin/
 ---> Using cache
 ---> 110bb43f3cfc
Step 20/26 : RUN mkdir /etc/redis
 ---> Using cache
 ---> 80f3fc513310
Step 21/26 : COPY --from=redis-dev /redis/redis.conf /etc/redis/
 ---> Using cache
 ---> 0fc7280f6738
Step 22/26 : RUN mkdir -p /usr/local/etc/redis
 ---> Using cache
 ---> 362645872a09
Step 23/26 : COPY redis.conf /usr/local/etc/redis/
 ---> Using cache
 ---> 9c545d22358f
Step 24/26 : EXPOSE 6379/tcp
 ---> Using cache
 ---> d41a476122fd
Step 25/26 : WORKDIR /sysvar-py
 ---> Using cache
 ---> 0cd5f4246142
Step 26/26 : ENTRYPOINT ["/startup/startup.sh"]
 ---> Using cache
 ---> 20ee87c5f5f4
Successfully built 20ee87c5f5f4
Successfully tagged redis:3.0

(base) root@adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker run --name=redis --publish=6379:6379 --hostname=redis --mount type=bind,source=/run,target=/run --detach redis:3.0
1fe16baec197920588783968fea43ceaba8286117d95b49e4d59b5a840d04241

(base) root@adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker ps -a

CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                     PORTS     NAMES
1fe16baec197   redis:3.0      "/startup/startup.sh"    5 seconds ago   Exited (1) 4 seconds ago             redis
c1aa99b92eca   redis          "docker-entrypoint.s…"   25 hours ago    Exited (0) 25 hours ago              funny_nobel
e236678456e2   redis          "docker-entrypoint.s…"   25 hours ago    Exited (0) 25 hours ago              quirky_lovelace
2772ad6a9c9b   4e873038b87b   "/bin/sh -c 'apk upd…"   28 hours ago    Exited (2) 28 hours ago              crazy_cohen
f34c6d1fde05   4e873038b87b   "/bin/sh -c 'apk upd…"   28 hours ago    Exited (2) 28 hours ago              ecstatic_taussig

(base) root@adminsaturn-virtual-machine:/media/sf_scefwp01/redis# docker exec -it redis bash

Error response from daemon: Container 1fe16baec197920588783968fea43ceaba8286117d95b49e4d59b5a840d04241 is not running

Here you can see build and container creating successfully but redis-server exited immediately. if we apply the docker exec -it redis bash command then getting Error response:Container is not running.

how can I fix this issue? Kindly provide me suggestion.

  • Can you [edit] the question to include a [mcve]? The `Dockerfile` is more interesting than the `docker build` output, and it seems like the contents of the `startup.sh` script are important as well. What's in the container output (`docker logs redis`, or `docker run` without a `-d` option)? – David Maze Sep 06 '22 at 15:01
  • (Can you use the [Docker Hub `redis` image](https://hub.docker.com/_/redis) rather than building your own?) – David Maze Sep 06 '22 at 15:01
  • You can check output form the container by: `docker logs 1fe16baec197 `, maybe it helps to understand what Is the issue. – quentino Sep 06 '22 at 22:06

0 Answers0