I am running IPFS with docker. The docker-compose.yml is as follows
#version of docker compose
version: '3'
services:
ipfshost:
image: ipfs/kubo:latest
container_name: ipfs
env_file:
- .env
ports:
- 4001:4001
- 4001:4001/udp
- 8081:8080
- 5001:5001
volumes:
- ./ipfs_staging:/export
- ./ipfs_data:/data/ipfs
- ./config:/data/ipfs/config
volumes:
ipfs_staging:
external: true
ipfs_data:
external: true
Currently the only way I can find to run CLI commands is using docker exec ipfs ipfs [command]. It's annoying to have to prepend docker exec ipfs to every command, but docker exec -it ipfs bash does not load a terminal.
The error is:
OCI runtime exec failed: exec failed: unable to start container process: exec: "bash": executable file not found in $PATH: unknown
I also tried docker exec -it ipfs /bin/bash
The resulting error is:
OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown
Is there a fairly straightforward way to solve this? The errors seem to indicate there is no bash software in the docker container.
Related
I want to get verbose output from mockwire when running in docker using docker compose file.
I tried these three ways but none of them work.
first way
services:
wiremock:
image: wiremock
ports:
- 8080:8080
restart: always
volumes:
- ./myfolder/mystuff:/home/wiremock
command: [--verbose]
second way
command: --verbose
third way
command:
- --verbose
I keep getting the error:
wiremock exec: "--verbose": executable file not found in $PATH: unknown
I've set up it in this way:
mocked-services:
image: wiremock/wiremock:2.33.2
command: "--global-response-templating --verbose"
I want to access the db directly through command prompt.
I run the command:
docker exec -it container_name -u user_name -p
Instead of a line asking me the user password I get the following error message:
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"-u\": executable file not found in $PATH": unknown
I've tried several other commands of the same type:
docker exec -it container_name -u -p
docker exec -it container_name -u user_name
docker exec -it container_name -u root
I don't use a Dockerfile but the image directly :
version: '3'
services:
frontend:
build: ./frontend
volumes:
- ./frontend/:/app
ports:
- ${PORT_FRONTEND}:${PORT_FRONTEND}
container_name: dev_frontend
database:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
ports:
- "${PORT_MARIADB}:${PORT_MARIADB}"
volumes:
- ./volumes/database/:/var/lib/mysql:rw
container_name: dev_mariadb
I use a .env file to store sensible data instead of placing them in the docker-compose.yml
If anyone has any idea on how to proceed to find the issue I'd be grateful.
Thanks!
Simply correct the command above with :
docker exec -it container_name mysql -u{username} -p{userpassword}
I am pretty noob in docker containerand docker compose.
I pulled in docker compose https://github.com/codeniko/pihole-coredns-tls-docker/blob/master/docker-compose.yml
I wanted to create entry point so I can enter container.
for which I made below changes
coredns_upstream:
image: "coredns/coredns"
tty: true
stdin_open: true
volumes:
- "./coredns/:/etc/coredns/"
command: -conf /etc/coredns/coreconfig-up
restart: unless-stopped
container_name: coredns_up
entrypoint: /bin/bash
networks:
coredns:
ipv4_address: 172.10.10.100
I added these changes:
tty: true
stdin_open: true
to be able to enter,
that didnt worked so I added
entrypoint: /bin/bash
that throws error when try to run container, docker compose up
ERROR: for coredns_upstream Cannot start service coredns_upstream: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
ERROR: Encountered errors while bringing up the project.
I am facing an issue with connect local redis with docker container, this is my docker compose file.
version: "3"
services:
test:
build: .
stdin_open: true
tty: true
command: nodemon --delay 6 index.js
volumes:
- .:/opt/test
ports:
- "5007:5007"
links:
- redis
redis:
image: redis:latest
container_name: qbo_redis
restart: always
ports:
- "6379:6379"
But it is not working.
Getting error
bash
TI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"3ed84a23c52d\": executable file not found in $PATH": unknown
If i remove the redis entries from docker-compose.yml file, its working without any error.
docker ps -q returns a list of containers and cannot be used to access the shell. Use docker ps -ql to work with the last container created.
redis images don't contain Bash. They're based on Alpine Linux, but can you use /bin/sh. Try this way:
docker exec -it qbo_redis /bin/sh
or
docker exec -it $(docker ps -ql) /bin/sh
I'm trying to use wait-for-it in my docker-compose.yaml to wait for mysql to be ready before creating services that are dependent on it. This is my docker-compose.yaml:
version: '3.5'
services:
mysql:
image: mysql:5.6
ports:
- "3307:3306"
networks:
- integration-tests
environment:
- MYSQL_DATABASE=mydb
- MYSQL_USER=root
- MYSQL_ROOT_PASSWORD=mypassword
entrypoint: ./wait-for-it.sh mysql:3306
networks:
integration-tests:
name: integration-tests
I get this error when trying to run this with docker-compose:
Starting integration-tests_mysql_1 ... error
ERROR: for integration-tests_mysql_1 Cannot start service mysql: OCI
runtime create failed: container_linux.go:348: starting container
process caused "exec: \"./wait-for-it.sh\": stat ./wait-for-it.sh: no
such file or directory": unknown
ERROR: for mysql Cannot start service mysql: OCI runtime create
failed: container_linux.go:348: starting container process caused
"exec: \"./wait-for-it.sh\": stat ./wait-for-it.sh: no such file or
directory": unknown ERROR: Encountered errors while bringing up the
project.
The wait-for-it.sh script is there on the same level as my docker-compose.yaml file so I don't understand why it's not being found.
Your issue here is that you're trying to execute something that is not part of your image. You're telling docker to create a container from mysql:5.6, which doesn't contain wait-for-it.sh, and then you're telling it to start the container by launching wait-for-it.sh.
I would recommend that you create your own image containing the following:
#Dockerfile
FROM mysql:5.6
COPY wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh
Then you would replace mysql:5.6 with your image and you should be able to execute wait-for-it.sh. I would also execute it through a command instead of an entrypoint as such:
#docker-compose.yml
...
mysql:
image: yourmysql:5.6
command: bash -c "/wait-for-it.sh -t 0 mysql:3306"
...
Where -t 0 will wait for mysql without a timeout.
You can control services startup order by using the docker depends_on option.