I am getting this message
nc command is missing
and by doing some R&D, I got to know that in order to resolve this, (I think) I need to run below command in MySQL container in docker-compose
RUN apt-get -q update && apt-get -qy install netcat
But the issue is I don't have it's docker file else I could have written this command in docker file and might have called docker file from docker-compose
Does anyone have any idea how can I run this command from docker-compose?
CodePudding user response:
You could build and publish your own container image if you wanted with a dockerfile like this
FROM mysql:8
RUN apt-get -q update && apt-get -qy install netcat
and build it like docker build . -t user123/mysql:8
and push it like docker push user123/mysql:8
then switch your docker compose to use your custom container.
if you just need to pop in temporarily to install netcat, you can do that by doing
docker exec -it --user=root ContainerHashOrName /bin/bash
where ContainerHashOrName
can be retrieved from docker ps
then just run your commands like you would on any other distro. Just be aware that you are only making changes to the specific instance of a container and that any rescheduling will bring up a different instance of the container.
CodePudding user response:
You can use "build" option of compose file, https://docs.docker.com/compose/compose-file/compose-file-v3/#build and use your own Dockerfile
starts with FROM mysql:8
and then install all additional stuff you need.