我有以下docker容器:
FROM debian:stretch-backports
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ruby ruby-dev \
curl wget \
gnupg \
git \
ncbi-blast+
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get update && apt-get install -y --no-install-recommends \
nodejs npm && \
rm -rf /var/lib/apt/lists/*
RUN wget -c https://github.com/wurmlab/sequenceserver/archive/1.1.0.beta10.tar.gz && \
apt-get update && apt-get install -y --no-install-recommends zlib1g-dev && \
gem install bundler && \
tar xfvz 1.1.0.beta10.tar.gz && \
cd sequenceserver-1.1.0.beta10 && \
npm install && \
bundle install
#RUN mkdir /db
VOLUME ["/db"]
EXPOSE 4567
WORKDIR /sequenceserver-1.1.0.beta10
ENTRYPOINT ["bundle", "exec", "bin/sequenceserver", "-d", "/db"]
当我启动容器时,它会以交互方式询问我一些问题以设置数据库:
$ docker run --rm -ti -p 4567:4567 -v $(pwd)/db:/db seqserver
fatal: Not a git repository (or any of the parent directories): .git
Could not find BLAST+ databases in: /db.
Search for FASTA files (.fa, .fasta, .fna) in '/db' and try
creating BLAST+ databases? [y/n] (Default: y).
>> y
Searching ...
FASTA file: /db/sequence.fasta
FASTA type: nucleotide
Proceed? [y/n] (Default: y): y
Enter a database title or will use 'sequence': Escherichia coli str. K-12 substr. MG1655, complete genome
Enter taxid (optional):
Building a new DB, current time: 07/02/2018 00:37:08
New DB name: /db/sequence.fasta
New DB title: Escherichia coli str. K-12 substr. MG1655, complete genome
Sequence type: Nucleotide
Keep MBits: T
Maximum file size: 1000000000B
Adding sequences from FASTA; added 1 sequences in 0.487213 seconds.
SEF-EEB-123137:sequenceserver lorencm$ ls db
sequence.fasta sequence.fasta.nhi sequence.fasta.nin sequence.fasta.nsd sequence.fasta.nsq
sequence.fasta.nhd sequence.fasta.nhr sequence.fasta.nog sequence.fasta.nsi
SEF-EEB-123137:sequenceserver lorencm$ docker run --rm -ti -p 4567:4567 -v $(pwd)/db:/db seqserver
fatal: Not a git repository (or any of the parent directories): .git
[2018-07-02 00:37:33] WARN Will listen on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--host option).
** SequenceServer is ready.
Go to http://localhost:4567 in your browser and start BLASTing!
Press CTRL+C to quit.
接下来,我想将上面的 Dockerfile 与 docker-compose 一起使用
$ cat docker-compose.yml
sequenceserver:
build: sequenceserver
# restart: always
ports:
- "4567:4567"
volumes:
- ./data/sequenceserver:/db
但不幸的是,我不再得到这些问题,只有以下输出:
$ docker-compose up
...
sequenceserver_1 | Enter taxid (optional): taxid should be a number
sequenceserver_1 | Enter taxid (optional): taxid should be a number
sequenceserver_1 | Enter taxid (optional): taxid should be a number
sequenceserver_1 | Enter taxid (optional): taxid should be a number
sequenceserver_1 | Enter taxid (optional): taxid should be a number
sequenceserver_1 | Enter taxid (optional): taxid should be a number
sequenceserver_1 | Enter taxid (optional): taxid should be a number
如何使用 docker-compose 进行交互式设置或者还有其他方法吗?
先感谢您。
答案1
您需要启动此命令,请尝试以下操作:
$ docker-compose up -d