azukiapp/azk

Possible to set user?

Closed this issue · 5 comments

Is it possible to set (and create) the user that is used for provisioning and shell, similar to RUN useradd myuser ... and USER myuser directives in a Dockerfile?

It is possible to run shell commands in provision. It let you create a user but there is no such configuration you can set to tell which user to be used, similar to USER supported by Dockerfile.

We recommend you to create a Dockerfile and use it in your Azkfile.js.

You can find instructions here: http://docs.azk.io/en/reference/azkfilejs/image.html#dockerfile

Using image: { dockerfile: "..." } seems to ignore provision, is that true?

No. Provisioning is works the same way. But it is important to remember that the provision only runs automatically on the first run, after which it is necessary to "force" it.

  • To force the provisioning run:

    $ azk start -R
  • To force the build image (Dockerfile) run:

    $ azk start -BR
# Dockerfile
FROM azukiapp/erlang

RUN mkdir /home/myself && useradd myself && chown -R myself /home/myself
ENV HOME /home/myself

USER myself

CMD ["erl"]
// Azkfile.js
systems({
  myApp: {
    // ...
    image: {"dockerfile": "./Dockerfile"},
    // ...
  },
  // ...
});

This works. Adding -R and -B did the trick.

very nice.