docker search tomcat |
without starting the container. example with Wordpress image.
docker pull wordpress |
docker images |
NAME DESCRIPTION STARS OFFICIAL AUTOMATED |
REPOSITORY TAG IMAGE ID CREATED SIZE |
docker ps |
of tomcat with mapping port 8080 of container to 8080 on server
docker run -it -p 8080:8080 tomcat |
docker run -d 8080:8080 tomcat |
work if no running containers on that image
docker rmi wordpress |
vi Dockerfile |
FROM amazonlinux RUN yum -y update RUN yum -y install httpd RUN yum -y install php COPY ./index.php /var/www/html/index.php CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] EXPOSE 80 |
<?php phpinfo(); ?> |
using Dockerfile in current "." directory
docker build --tag example/amzn-phpinfo . |
docker image history example/amzn-phpinfo |
IMAGE CREATED CREATED BY SIZE COMMENT |
docker image inspect example/amzn-phpinfo |
use one RUN instead of 3 RUN commands
FROM amazonlinux RUN yum -y update && yum -y install httpd && yum -y install php COPY ./index.php /var/www/html/index.php CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"] EXPOSE 80 |
docker build --tag example/amzn-phpinfo2 . |
docker images |
REPOSITORY TAG IMAGE ID CREATED SIZE |
docker image history example/amzn-phpinfo |
IMAGE CREATED CREATED BY SIZE COMMENT |
docker image history example/amzn-phpinfo2 |
IMAGE CREATED CREATED BY SIZE COMMENT |
docker run -it example/amzn-phpinfo2 bin/bash |
bash-4.2# echo '<?php phpversion() ?>' >/var/www/html/vesrion.php exit |
docker ps --all |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8d08f05d5485 example/amzn-phpinfo2 "bin/bash" 4 minutes ago Exited (0) 13 seconds ago determined_pascal 9d839e5a0674 example/amzn-phpinfo2 "/usr/sbin/httpd -D …" 4 minutes ago Exited (0) 4 minutes ago intelligent_chaum |
docker commit --author "Oleksandr Liutyi" --message "version.php added" 8d08f05d5485 example/amzn-phpinfo2 |
docker image history example/amzn-phpinfo2 |
IMAGE CREATED CREATED BY SIZE COMMENT afcc5e67edec About a minute ago bin/bash 112B version.php added 09cfca98bf82 27 minutes ago /bin/sh -c #(nop) EXPOSE 80 0B e0f8728488e3 27 minutes ago /bin/sh -c #(nop) CMD ["/usr/sbin/httpd" "-… 0B fe1e985876af 27 minutes ago /bin/sh -c #(nop) COPY file:7aa92ce52044b7f0… 20B 4f0abf0cea3b 27 minutes ago /bin/sh -c yum -y update && yum -y install h… 283MB cd2d92bc1c0c 2 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B <missing> 2 weeks ago /bin/sh -c #(nop) ADD file:119ae574c5d5b6e59… 163MB |