Created
January 15, 2018 15:30
-
-
Save enlacee/ae5c7937ac2025bde6eaaaa2090808b8 to your computer and use it in GitHub Desktop.
Cómo crear una imagen para Docker usando un Dockerfile http://picodotdev.github.io/blog-bitix/2014/11/como-crear-una-imagen-para-docker-usando-un-dockerfile/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker build -t "picodotdev/base:1.0" docker/base | |
$ docker build -t "picodotdev/mysql:1.0" docker/mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker run --name mysql-data -d -v /var/lib/mysql busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker run --name mysql -d -p 3306:3306 --volumes-from mysql-data picodotdev/mysql:1.0 /sbin/my_init | |
3f5774999a7850ff4c8c0512ff066daf67a6e19499113ee9f04dc2511972a163 | |
$ docker stop 3f5774999 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM phusion/baseimage:0.9.15 | |
MAINTAINER picodotdev <pico.dev@gmail.com> | |
ENV HOME /root | |
RUN apt-get update -q | |
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh | |
RUN echo 'root:$6$l/PahbyY$jFhqIAuvHeK/GwjfT71p4OBBkHQpnTe2FErcUWZ8GIN1ykdI7CgL05Jkk7MYW6l.0pijAlfoifkQnLpaldEJY0' | chpasswd -e | |
ADD bashrc /root/.bashrc | |
ADD timezone /etc/timezone | |
EXPOSE 22 | |
CMD ["/sbin/my_init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM picodotdev/base:1.0 | |
MAINTAINER picodotdev <pico.dev@gmail.com> | |
ENV HOME /root | |
RUN apt-get install -y mysql-server mysql-client | |
ADD my.cnf /etc/mysql/my.cnf | |
RUN mkdir /etc/service/mysql | |
ADD mysql /etc/service/mysql/run | |
RUN chmod +x /etc/service/mysql/run | |
RUN rm -R /var/lib/mysql && \ | |
mkdir /var/lib/mysql && \ | |
mkdir /mnt/keys | |
VOLUME ["/var/lib/mysql", "/mnt/keys"] | |
RUN apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
EXPOSE 22 3306 | |
CMD ["/sbin/my_init"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment