# Mounting a host volume

**URL:** <https://forum.ansible.com/t/mounting-a-host-volume/30188>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 25, 2019, 5:45pm UTC](https://forum.ansible.com/t/mounting-a-host-volume/30188 "2019-04-25T17:45:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toby](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@Toby](https://forum.ansible.com/u/Toby)\
**Post date:** [April 25, 2019, 5:45pm UTC](https://forum.ansible.com/t/mounting-a-host-volume/30188/1 "2019-04-25T17:45:50Z")

</div>

Hi all. Hopefully a straightforward question to those that have had more exposure to AWX than I…

I have AWX installed, successfully, using local Docker/DB. I am wanting to add a host volume so that I can access certain files within the AWX containers.

These are software installation files, that I don’t really want to add to my Git repository, due to their size.

I added volume mounts in the default docker-compose.yml I use to stop/start the containers (/software) but they don’t appear to do anything/get ignored:

`  
…

web:  
image: ansible/awx\_web:4.0.0  
container\_name: awx\_web  
depends\_on:

- rabbitmq
- memcached
- postgres  
ports:
- “80:8052”  
hostname: awxweb  
user: root  
restart: unless-stopped  
volumes:  
**- /software:/software**
- “/tmp/awxcompose/SECRET\_KEY:/etc/tower/SECRET\_KEY”
- “/tmp/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh”
- “/tmp/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py”  
environment:  
http\_proxy:  
https\_proxy:  
no\_proxy:

task:  
image: ansible/awx\_task:4.0.0  
container\_name: awx\_task  
depends\_on:

- rabbitmq
- memcached
- web
- postgres  
hostname: awx  
user: root  
restart: unless-stopped  
volumes:  
**- /software:/software**
- “/tmp/awxcompose/SECRET\_KEY:/etc/tower/SECRET\_KEY”
- “/tmp/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh”
- “/tmp/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py”  
environment:  
http\_proxy:  
https\_proxy:  
no\_proxy:

…  
`

I am new to Docker/AWX. What I am doing wrong?

---

<div class="post-metadata">

**Author:** ![David\_Maple](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@David\_Maple](https://forum.ansible.com/u/David_Maple)\
**Post date:** [April 25, 2019, 8:04pm UTC](https://forum.ansible.com/t/mounting-a-host-volume/30188/2 "2019-04-25T20:04:20Z")

</div>

That configuration is where you attach the volumes to the containers. There should be another section where the volumes are defined. It’s usually further down the file after all the containers. Search for one of the other volumes and you should see where to put it and use the other volumes as examples.

Dave

---

<div class="post-metadata">

**Author:** ![Toby](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@Toby](https://forum.ansible.com/u/Toby)\
**Post date:** [April 26, 2019, 9:16am UTC](https://forum.ansible.com/t/mounting-a-host-volume/30188/3 "2019-04-26T09:16:35Z")

</div>

Hi Dave, thanks for taking the time to reply.

The configuration listed is the _default_ docker-compose.yml in /tmp/awxcompose and there are no further volume configurations/declarations, other than those defined within the services. I post here the full version:

`  
version: ‘2’  
services:

web:  
image: ansible/awx\_web:4.0.0  
container\_name: awx\_web  
depends\_on:

- rabbitmq
- memcached
- postgres  
ports:
- “80:8052”  
hostname: awxweb  
user: root  
restart: unless-stopped  
volumes:
- /software:/software
- “/tmp/awxcompose/SECRET\_KEY:/etc/tower/SECRET\_KEY”
- “/tmp/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh”
- “/tmp/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py”  
environment:  
http\_proxy:  
https\_proxy:  
no\_proxy:

task:  
image: ansible/awx\_task:4.0.0  
container\_name: awx\_task  
depends\_on:

- rabbitmq
- memcached
- web
- postgres  
hostname: awx  
user: root  
restart: unless-stopped  
volumes:
- /software:/software
- “/tmp/awxcompose/SECRET\_KEY:/etc/tower/SECRET\_KEY”
- “/tmp/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh”
- “/tmp/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py”  
environment:  
http\_proxy:  
https\_proxy:  
no\_proxy:

rabbitmq:  
image: ansible/awx\_rabbitmq:3.7.4  
container\_name: awx\_rabbitmq  
restart: unless-stopped  
environment:  
RABBITMQ\_DEFAULT\_VHOST: “awx”  
RABBITMQ\_DEFAULT\_USER: “guest”  
RABBITMQ\_DEFAULT\_PASS: “awxpass”  
RABBITMQ\_ERLANG\_COOKIE: cookiemonster

memcached:  
image: memcached:alpine  
container\_name: awx\_memcached  
restart: unless-stopped

postgres:  
image: postgres:9.6  
container\_name: awx\_postgres  
restart: unless-stopped  
volumes:

- /tmp/pgdocker:/var/lib/postgresql/data:Z  
environment:  
POSTGRES\_USER: awx  
POSTGRES\_PASSWORD: awxpass  
POSTGRES\_DB: awx  
PGDATA: /var/lib/postgresql/data/pgdata

`

According to the [docker compose](https://docs.docker.com/compose/compose-file/compose-file-v2/) documentation (see “volumes”), what I have done looks to be correct? I seem to be missing something pretty fundamental, probably due to my lack of experience.

If you, or anyone else, has successfully achieved this with AWX, I’d love to learn how.

Thanks,

Toby.

---

<div class="post-metadata">

**Author:** ![Micah\_Joiner](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Micah\_Joiner](https://forum.ansible.com/u/Micah_Joiner)\
**Post date:** [April 26, 2019, 9:44am UTC](https://forum.ansible.com/t/mounting-a-host-volume/30188/4 "2019-04-26T09:44:44Z")

</div>

I have not used the container mount directive as i did not want to modify the file since i update the AWX servers regularly. I simply loaded my files that i did not want to have in the GIthub Repository into the Docker hosts /var/lib/awx/projects Directory. I have a few directories there that i utilize for Scripts, Documentation, and Binary’s that i use within my playbooks.

This I am sure is not the correct way to utilize the directory but it is how you manage local Git repos and i have had great success with it. You could look for the section of the compose file that has this directory path and possibly just add an addition to meet your requirements.

---

<div class="post-metadata">

**Author:** ![Toby](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@Toby](https://forum.ansible.com/u/Toby)\
**Post date:** [April 26, 2019, 12:24pm UTC](https://forum.ansible.com/t/mounting-a-host-volume/30188/5 "2019-04-26T12:24:28Z")

</div>

Thanks for sharing your experience Micah. I really think what I am trying to do should be possible, and I don’t understand why it’s not working.

I just perform a bind mount using a different docker-compose.yml file, with an Ubuntu container, on the same machine, and it works just fine:

`  
myhost → cat docker-compose.yml  
version: ‘2’  
services:

test:  
image: ubuntu:14.04  
container\_name: test  
restart: unless-stopped  
entrypoint: tail -f /dev/null  
volumes:

- /software:/software

myhost → docker-compose start  
Starting test … done

myhost → docker exec -it test /bin/bash  
root@273c72e0f914:/# df  
Filesystem 1K-blocks Used Available Use% Mounted on  
overlay 66581072 27549272 39031800 42% /  
tmpfs 4078992 0 4078992 0% /dev  
tmpfs 4078992 0 4078992 0% /sys/fs/cgroup  
**/dev/mapper/swvg-swlv 123723328 84848164 32881932 73%**  **/software**  
/dev/sda2 66581072 27549272 39031800 42% /etc/hosts  
shm 65536 0 65536 0% /dev/shm  
tmpfs 4078992 0 4078992 0% /proc/acpi  
tmpfs 4078992 0 4078992 0% /proc/scsi  
tmpfs 4078992 0 4078992 0% /sys/firmware  
root@273c72e0f914:/# ll /software  
total 44  
drwxr-xr-x 9 root root 4096 Oct 2 2018 ./  
drwxr-xr-x 1 root root 33 Apr 26 12:10 …/  
drwxr-xr-x 2 root root 4096 May 23 2018 Couchbase/  
drwxr-xr-x 2 root root 4096 Jun 5 2018 GE\_Software/  
drwxr-xr-x 6 root root 4096 Apr 24 11:01 GIT\_repositories/  
drwxr-xr-x 10 root root 4096 Oct 3 2018 IBM\_Software/  
drwxr-xr-x 5 root root 4096 Apr 25 13:00 Oracle\_Software/  
drwxr-xr-x 2 root root 4096 Jul 24 2018 RedHat\_Cloudforms/  
drwxr-xr-x 2 root root 16384 Dec 18 2017 lost+found/  
`

Is anyone else able to help?

``

---

<div class="post-metadata">

**Author:** ![Toby](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@Toby](https://forum.ansible.com/u/Toby)\
**Post date:** [April 26, 2019, 4:39pm UTC](https://forum.ansible.com/t/mounting-a-host-volume/30188/6 "2019-04-26T16:39:47Z")

</div>

Oh my, it appears I hadn’t realised the difference between docker-compose ‘up’ vs ‘start’!

Modifying the docker-compose.yml file with the required volumes and running ‘docker-compose up -d’ to rebuild/start the images has resolved my issue.

I knew it was something silly.

Thanks to those who responded.
