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