Docker basics-containerize applications
Learn Docker fundamentals: containers, images, Dockerfiles, running containers, and container management.
On this page
Docker packages applications in containers - isolated, portable environments that work on any system. No "works on my machine" problems.
Images vs containers
- Image: Template (like a class) - defines what's included
- Container: Running instance (like an object) - actual execution
- One image → many containers
Run containers
docker run -d -p 80:80 --name web nginx
# -d: detached (background)
# -p: port mapping (host:container)
# --name: container name
# nginx: image name
Build with Dockerfile
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y python3
COPY app.py /app/
CMD ["python3", "/app/app.py"]
docker build -t myapp:1.0 .
Manage containers
docker ps # List running containers
docker stop container-name # Stop container
docker rm container-name # Remove container
docker logs container-name # View logs
docker exec -it container-name bash # Enter container
Pre-made images exist for most applications: node, python, mysql, wordpress, etc. Start with existing images.
Related: aaPanel Docker | Command line
Need a developer-friendly server?
Use an UnderHost Cloud VPS for SSH, Git, Node.js, Python, Laravel, Docker, cron, and custom development workflows.





















