docker-alpine
docker-alpine copied to clipboard
docker-alpine redis how to get into bash
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 714ecf80a71b smebberson/alpine-redis "/init" 39 minutes ago Up 39 minutes 6379/tcp redis $ docker exec -it redis bash exec: "bash": executable file not found in $PATH
These images don't contain Bash. They're based on Alpine Linux, but can you use docker exec -it with-contenv sh
. This will give you a command line in the container with environment variables loaded.
I hope that helps. Please let me know so I can close out this issue if this has resolved your issue.
Yes. You can close it. I use ash for now from alpine linux. I have few questions regarding the redis-server and redis-cli, I want one Generic Redis Server Container and then 'N' number of Redis-CLI Container(with only the redis-cli tools) I wanted only the redis-cli container to get created when i run the below docker-compose file docker-compose.yml file Original compose-file rcli: image: redis:latest links: - redis command: redis-cli -h redis
Converting to alpine linux: rcli image: smebberson/alpine-redis links:
- redis command: redis-cli -h redis
Using Docker Network options with the link below can we achieve what am intended? https://github.com/sickp/docker-alpine-redis
I wanted to call the below compose command from the webapp, the idea is to share the redis-server container with mulitple users only via redis-cli container exposing the redis-cli in web
docker-compose run rcli
Let me look into this and get back to you.
any luck? regarding the cli and server redis container with cli container exposed to web and allowing the cli and redis server talking to internal private n/w
you can install bash by adding to your Dockerfile: RUN apk add --update bash && rm -rf /var/cache/apk/*
If you don't want to add to the size by installing bash, you can just run /bin/sh
Usually, an Alpine Linux image doesn't contain bash, Instead you can use /bin/ash, /bin/sh, ash or only sh.
docker run -it --rm alpine /bin/ash
docker run -it --rm alpine /bin/sh
docker run -it --rm alpine ash
docker run -it --rm alpine sh
--rm
Automatically remove the container when it exits.
I hope this information helps you.
Usually, an Alpine Linux image doesn't contain bash, Instead you can use /bin/ash, /bin/sh, ash or only sh. i.e:
docker run -it --rm alpine /bin/ash
docker run -it --rm alpine /bin/sh
docker run -it --rm alpine ash
docker run -it --rm alpine sh
I hope this information helps you.
apk --update bash
if you need bash for other things also, like running scripts, this command could be useful.
Just replace BASH to SH
docker exec -it some-docker_app_1 sh
docker exec -it CONTAINER_ID sh
@jansanchez is there any difference in any of these shells?