azukiapp / azk

azk is a lightweight open source development environment orchestration tool. Instantly & safely run any environment on your local machine.
http://azk.io
Apache License 2.0
897 stars 63 forks source link

Possible to set user? #517

Closed eproxus closed 9 years ago

eproxus commented 9 years ago

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?

gullitmiranda commented 9 years ago

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

eproxus commented 9 years ago

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

gullitmiranda commented 9 years ago

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.

# 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"},
    // ...
  },
  // ...
});
eproxus commented 9 years ago

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

gullitmiranda commented 9 years ago

very nice.