Dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Use an Ubuntu image as base image
  2. FROM alpine:latest
  3. # Metadata for the container
  4. LABEL description="Attempt to create a 'VM' in docker"
  5. # Set the working directory inside the container for the following Dockerfile instructions
  6. WORKDIR /root
  7. # Use an argument sent to the "docker build" command inside the Dockerfile
  8. #ARG USERNAME
  9. #RUN echo ${USERNAME} >> username
  10. # Run several commands in a same line, to avoid creating intermediate junk images
  11. RUN /bin/ash -c 'apk upgrade; apk add vim tmux bash'
  12. RUN /bin/ash -c 'adduser user --disabled-password --home /home/user --shell /bin/bash'
  13. RUN /bin/ash -c 'mkdir -p /home/user/'
  14. # Set environment variables
  15. #ENV foo_folder /home
  16. # Copy files to the container
  17. COPY bashrc /home/user/.bashrc
  18. COPY tmux.conf /home/user/.tmux.conf
  19. COPY profile /home/user/.profile
  20. RUN chown -R user:user /home/user/
  21. # Define a volume (in the Dockerfile you cannot set the location of a volume inside the host machine)
  22. VOLUME /home/user/data
  23. # Make sure we actually can write to it
  24. RUN chown -R user:user /home/user/data
  25. RUN chmod 755 /home/user/data
  26. # Set the entrypoint for the container, that means, the command to be executed when run
  27. #ENTRYPOINT ["python3", "script.py"]
  28. USER user
  29. WORKDIR /home/user
  30. ENTRYPOINT ["/bin/bash"]