smebberson / docker-alpine

Docker containers running Alpine Linux and s6 for process management. Solid, reliable containers.
MIT License
596 stars 186 forks source link

docker-alpine redis how to get into bash #43

Open mkscala opened 8 years ago

mkscala commented 8 years ago

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

smebberson commented 8 years ago

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.

mkscala commented 8 years ago

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:

Converting to alpine linux: rcli image: smebberson/alpine-redis links:

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

smebberson commented 8 years ago

Let me look into this and get back to you.

mkscala commented 8 years ago

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

fidmor89 commented 8 years ago

you can install bash by adding to your Dockerfile: RUN apk add --update bash && rm -rf /var/cache/apk/*

dondre commented 7 years ago

If you don't want to add to the size by installing bash, you can just run /bin/sh

jansanchez commented 7 years ago

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.

jansanchez commented 7 years ago

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.

zakkg3 commented 6 years ago

apk --update bash if you need bash for other things also, like running scripts, this command could be useful.

williaanlopes commented 4 years ago

Just replace BASH to SH docker exec -it some-docker_app_1 sh

NanheKumar commented 4 years ago

docker exec -it _CONTAINERID sh

ghost commented 2 years ago

@jansanchez is there any difference in any of these shells?