Azurite Blob storage in dockerfile

Viewed 954

I'm creating my development environment in Docker and due to need of Azure Storage service I want to use Azurite as local Azure Storage service.

When I try to do

RUN azurite-blob &

it just runs and no effect is done by this command. I also tried echo this command to file and run as script, but the result was the same.

When I run the same command on docker container it starts normally and creates various catalogs for azurite.

So the question is how to make azurite working in background in Dockerfile?

1 Answers

you can not make a command to work in background inside the build steps of the dockerfile, since every steps will run in a seperate layer and will removed when the step finished.

you may use:

  • ENTRYPOINT or CMD to achieve that (aka run it in the runtime not build)

UPDATE

based on your comment:

create script.sh:

#!/bin/bash

/usr/bin/azurite &

exec "$@"

you need to set it as executable first , in Dockerfile:

COPY script.sh script.sh
RUN chmod +x script.sh

then you can use bash as your command for interactive mode

Related