Symbolic link get not created inside docker container

docker-compose

Unfortunately, I am not able to create this symbolic link (&& ln -s /db /var/www/html/blast/db/) inside the docker container. What did I miss?

FROM ubuntu:16.04

# File Author / Maintainer
MAINTAINER Rafael Hernandez <https://github.com/fikipollo>

################## BEGIN INSTALLATION ######################
#Add the link to internal MRS service
RUN apt-get update \
    && apt-get -y install build-essential ruby ruby-dev ncbi-blast+ nginx php-fpm apache2-utils sudo wget csh fcgiwrap \
    && apt-get clean \
    && gem install sequenceserver \
    && gem install ncbi-blast-dbs

ENV ADMIN_USER=admin \
    ADMIN_PASS=supersecret \
    MAX_FILE_SIZE=300 \
    CPU_NUMBER=4

COPY configs/* /tmp/ 

ADD ./blast /var/www/html/blast

RUN mv /tmp/*.html /var/www/html/ \
    && mv /tmp/*.png /var/www/html/ \
    && mv /tmp/*.php /var/www/html/ \
    && cat /tmp/rules >> /etc/sudoers \
    && mv /tmp/default /etc/nginx/sites-available/ \
    && mv /tmp/entrypoint.sh /usr/bin/entrypoint.sh \
    && chmod +x /usr/bin/entrypoint.sh \
    && mv /tmp/admin_tools /usr/local/bin/admin_tools \
    && chmod +x /usr/local/bin/admin_tools \
    && mv /tmp/sequenceserver /etc/init.d/sequenceserver  \
    && chmod +x /etc/init.d/sequenceserver \
    && ln -s /db /var/www/html/blast/db/ \
    && chown www-data:www-data /var/www/html/* \
    && chmod 660 /var/www/html/*.* \
    && chmod o+w /var/www/html/blast/TmpGifs/ \
    && htpasswd -b -c /etc/nginx/.htpasswd admin supersecret

##################### INSTALLATION END #####################

ENTRYPOINT ["/usr/bin/entrypoint.sh"]

.

version: '2'
services:

    instance1-blast:
      build: .
      container_name: instance1-blast
      environment:
        - ADMIN_USER=admin
        - ADMIN_PASS=123
        - MAX_FILE_SIZE=50
        - CPU_NUMBER=5
      depends_on:
        - instance1-data
      volumes_from:
        - instance1-data
      ports:
        - "8094:80"
        - "8095:4567"

    instance1-vsftpd:
      image: fikipollo/vsftpd
      container_name: instance1-vsftpd
      environment:
        - FTP_USER=ftpuser
        - FTP_PASS=supersecret
        - ONLY_UPLOAD=YES
        - PASV_ENABLE=NO
        - FTP_HOME=/raw
        - UMASK=000
      depends_on:
        - instance1-data
      volumes_from:
        - instance1-data
      ports:
        - "8096:21"

    instance1-data:
      image: busybox
      container_name: instance1-data
      volumes:
        - /data/instance1-data/blast-data/db:/db
        - /data/instance1-data/blast-data/raw:/raw
        - /data/instance1-data/blast-data/tmp:/tmp

Thank you in advance.

Best Answer

&& ln -s /db /var/www/html/blast/db/

I do not see in your Dockerfile where either:

/db /var/www/html/blast/db

directories are being created. These directories both seem non-standard to me, and therefore likely do not already exist in your base image. Try adding this line somewhere in your Dockerfile BEFORE your command to create the symlink:

RUN mkdir -p /var/www/html/blast/db && \ mkdir -p /var/www/html/blast/db

Also, the other thing I would check is that ls command works and can "see" those directories, once you have confirmed that they are being created in your Docker Image filesystem, to also be reflected in your Container's filesystem...

If this does not work, as Charles already asked, please paste the output of your docker build command and any error output you get when launching a container from that resulting image...