Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:docker-advanced [2019/07/12 17:03] alfred [Execute GUI programs] |
wiki2:docker-advanced [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 83: | Línea 83: | ||
| docker cp c:\myfolder\myfile.txt dummy:/root/myfile.txt | docker cp c:\myfolder\myfile.txt dummy:/root/myfile.txt | ||
| docker rm dummy | docker rm dummy | ||
| + | </code> | ||
| + | |||
| + | ==== Creación de un volumen mapeado en nfs (docker-compose) ==== | ||
| + | <code yml> | ||
| + | volumes: | ||
| + | nas-owncloud: | ||
| + | driver: local | ||
| + | driver_opts: | ||
| + | type: nfs | ||
| + | o: "addr=10.10.10.10,nolock,soft,rw" | ||
| + | device: ":/volume1/sir-vices/owncloud" | ||
| + | |||
| + | services: | ||
| + | owncloud: | ||
| + | volumes: | ||
| + | - nas-owncloud:/mnt/data | ||
| </code> | </code> | ||
| ===== Compose ===== | ===== Compose ===== | ||
| Línea 169: | Línea 185: | ||
| firefox | firefox | ||
| </code> | </code> | ||
| + | |||
| + | You could also use the run with the cmd as parameter, in this way you could install several programs and launch them with this. | ||
| + | |||
| + | ==== Launch them from SSH ==== | ||
| + | |||
| + | |||
| + | As it says here [[https://docs.docker.com/engine/examples/running_ssh_service/]] you can create a Dockerfile with... | ||
| + | <code> | ||
| + | FROM ubuntu:16.04 | ||
| + | |||
| + | RUN apt-get update && apt-get install -y openssh-server | ||
| + | RUN mkdir /var/run/sshd | ||
| + | RUN echo 'root:THEPASSWORDYOUCREATED' | chpasswd | ||
| + | RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
| + | |||
| + | # SSH login fix. Otherwise user is kicked off after login | ||
| + | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | ||
| + | |||
| + | ENV NOTVISIBLE "in users profile" | ||
| + | RUN echo "export VISIBLE=now" >> /etc/profile | ||
| + | |||
| + | EXPOSE 22 | ||
| + | CMD ["/usr/sbin/sshd", "-D"] | ||
| + | </code> | ||
| + | ... for an ssh server. | ||
| + | |||
| + | This one will be prepared for launching a remote firefox in your local machine if you connect to it via ssh and launch it. | ||
| + | <code> | ||
| + | FROM ubuntu:14.04 | ||
| + | |||
| + | RUN apt-get update && apt-get install -y firefox openssh-server | ||
| + | RUN mkdir /var/run/sshd | ||
| + | RUN echo 'root:train' | chpasswd | ||
| + | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
| + | |||
| + | # SSH login fix. Otherwise user is kicked off after login | ||
| + | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | ||
| + | |||
| + | ENV NOTVISIBLE "in users profile" | ||
| + | RUN echo "export VISIBLE=now" >> /etc/profile | ||
| + | RUN echo "X11UseLocalhost no" >> /etc/ssh/sshd_config | ||
| + | |||
| + | EXPOSE 22 | ||
| + | CMD ["/usr/sbin/sshd", "-D"] | ||
| + | # CMD tail -f /dev/null | ||
| + | </code> | ||
| + | |||
| + | |||