Home Docker Notes
Post
Cancel

Docker Notes

Pull down the latest Ubuntu image

1
docker pull ubuntu

Real simple “Hello, World” example

1
docker run ubuntu /bin/echo "hello there, docker user"

List images

1
docker images

List running Docker containers

1
docker ps

List ALL docker containers (stopped and otherwise)

1
docker ps -a

Simple dockerfile for Apache web server with PHP

Always be wary of using Docker images that are not verified.

1
2
3
4
5
6
FROM kstaken/apache2
MAINTAINER Kimbro Staken version: 0.1
RUN apt-get update && apt-get install -y php5 libapache2-mod-php5 php5-mysql php5-cli telnet && apt-get clean && rm -rf /var/lib/apt/lists/*
EXPOSE 80

CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]

Entering into a Docker container

1
docker exec -it container_name bash

Running a Docker container, naming it and exposing a port

1
docker run -itd -p 82:80 --name container_name image_name

Viewing the logs for a container

1
docker logs container_name
This post is licensed under CC BY 4.0 by the author.