/shared folder not mounted in Docker container

Hi. I setup Discourse with Docker 1.6.2 (build 7c8fca2). It tried on my localhost first, then did in production server. On my localhost, from container I can see /shared folder, while in production server, I cannot find.

$ ./launcher enter app
root@prodhk-app:/var/lib/docker/aufs/mnt/c97af5f16febf4ae5e0f01a47750381373f3003f0fad79eddab6b89074a7a389# ls /
bin   home            lib64       nonexistent  run      sys  vmlinuz
boot  initrd.img      lost+found  opt          sbin     tmp  vmlinuz.old
dev   initrd.img.old  media       proc         selinux  usr
etc   lib             mnt         root         srv      var

How can I solve this? I need the shared folder to backup the database.

Different location on host and container

https://github.com/discourse/discourse_docker/blob/master/samples/standalone.yml#L70-L73

2 Likes

Excuse me. I don’t understand what you mean.

The config means that the folder /var/discourse/shared/standalone in host will be mounted as /shared in container. But as you can see in my demonstration, after enter the container, I list directory at / but don’t see shared.

I also try

cd /shared

but no working.

what is your container config?

This is my container config: http://pastie.org/10244604

This is the command generated when I run ./launch start app

/usr/bin/docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=2 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e HOME=/root -e db_shared_buffers=128MB -e DISCOURSE_DEVELOPER_EMAILS=xxx@example.com -e DISCOURSE_HOSTNAME=forum.example.com -h prodhk-app -e DOCKER_HOST_IP=172.17.42.1 --name app -t -p 127.0.0.1:8080:80 -p 2222:22 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log local_discourse/app /sbin/boot
7c7f4a00525254ad0eb2ab5f745113a54ada0c9b05fa07761299bed4891ea19c

(I excluded the detail related to SMTP config)

— Update 1 ----

I can see the shared folder in immediate current folder after entering the container, which has very long path, but not in “/”

$ ./launcher enter app
root@prodhk-app:/var/lib/docker/aufs/mnt/7c7f4a00525254ad0eb2ab5f745113a54ada0c9b05fa07761299bed4891ea19c# pwd
/var/lib/docker/aufs/mnt/7c7f4a00525254ad0eb2ab5f745113a54ada0c9b05fa07761299bed4891ea19c
root@prodhk-app:/var/lib/docker/aufs/mnt/7c7f4a00525254ad0eb2ab5f745113a54ada0c9b05fa07761299bed4891ea19c# ls
bin   dev  home  lib64  mnt  proc  root  sbin    src  sys  usr
boot  etc  lib   media  opt  pups  run   shared  srv  tmp  var
root@prodhk-app:/var/lib/docker/aufs/mnt/7c7f4a00525254ad0eb2ab5f745113a54ada0c9b05fa07761299bed4891ea19c# ls /
bin   etc         initrd.img.old  lost+found  nonexistent  root  selinux  tmp  vmlinuz
boot  home        lib             media       opt          run   srv      usr  vmlinuz.old
dev   initrd.img  lib64           mnt         proc         sbin  sys      var

But this “shared” folder doesn’t contains any subfolder, such as postgres_backup, uploads…

  • Another issue, may be related to this, is that some files of Discourse are changed the name:
root@prodhk-app:/var/lib/docker/aufs/mnt/7c7f4a00525254ad0eb2ab5f745113a54ada0c9b05fa07761299bed4891ea19c# cd var/www/discourse/public/images/welcome/
root@prodhk-app:/var/lib/docker/aufs/mnt/7c7f4a00525254ad0eb2ab5f745113a54ada0c9b05fa07761299bed4891ea19c/var/www/discourse/public/images/welcome# ls
emoji-completion-2x.png         quote-reply-cs.png              topic-notification-control-2x.png
like-link-flag-bookmark-2x.png  reply-as-linked-topic-2x.png    topics-new-unread-2x.png
notification-panel-2x.png       reply-post-2x.png               username-completion-2x.png
progress-bar-2x.png             reply-topic-2x.png              username-completion-cs.png
quote-reply-2x.png              topic-list-select-areas-2x.png

The reply-post.png is changed to reply-post-2x.png. This makes images in our forum broken.

---- Update 2

I can access /shared folder if I use ./launcher ssh app to enter the container.