Munchkin
Munchkin

Reputation: 4956

where are apps installed using apt-get within Dockerfile?

I'm new to Docker. I'm on a Windows machine. I wrote this Dockerfile:

FROM ubuntu:xenial
MAINTAINER [email protected]
EXPOSE 1883 1883
RUN apt-get update && apt-get install mosquitto -y
CMD ["mosquitto"]

It was successful: I was able to build & start the image and after that I also was able to connect a client to the mosquitto-server - so that means the mosquitto-server was running in the docker-container.

As a next test case, I want to overwrite the default mosquitto-config-file, so I think I can use the ADD statement in my Dockerfile (and then rebuilding). But therefore I need to know where mosquitto is installed. I ssh into the VM and I expected mosquitto in /etc/mosquitto, but there is no such folder.

1) where is mosquitto?

2) why can't I run mosquitto ("not found") while ssh in the VM - but CMD ["mosquitto"] works?

3) Is it best practise to use ADD in my case?

Upvotes: 0

Views: 71

Answers (2)

GianArb
GianArb

Reputation: 1684

Your mosquitto is not inside your VM but inside your container, to enter inside your container (it must be run) you can try to do:

docker exec -it <containerID> /bin/bash

Now you are in your container and you can find mosquitto.

It's a good practice use ADD but remember to re-build your container to apply this change.

Upvotes: 1

t6nand
t6nand

Reputation: 780

I am not sure exactly where do the files get stored but after docker-machine ssh you can go to folder /var/lib/docker/aufs/diff/ or /var/lib/docker/aufs/mnt/ as root and investigate your way around. Alternatively it is better to add your custom config file in Dockerfile itself by using COPY command. Make sure to put your config file in the appropriate folder like app/config/.., etc.

Upvotes: 0

Related Questions