Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ct83/ubuntu-docker-compose-starter-pack
Starter pack to help creating Ubuntu Containers using Docker and Docker Compose easier. 🐳
https://github.com/ct83/ubuntu-docker-compose-starter-pack
docker docker-compose docker-compose-template starter-kit starter-template ubuntu-container
Last synced: 6 days ago
JSON representation
Starter pack to help creating Ubuntu Containers using Docker and Docker Compose easier. 🐳
- Host: GitHub
- URL: https://github.com/ct83/ubuntu-docker-compose-starter-pack
- Owner: CT83
- License: bsd-2-clause
- Created: 2019-10-05T05:05:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-05T13:06:59.000Z (over 5 years ago)
- Last Synced: 2025-01-03T02:34:35.767Z (13 days ago)
- Topics: docker, docker-compose, docker-compose-template, starter-kit, starter-template, ubuntu-container
- Language: Dockerfile
- Size: 3.91 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ubuntu-Docker-Compose-Starter-Pack
Recently, I was trying to spin up a simple Ubuntu container. I noticed that a simple guide with some basic boilerplate code was too difficult to find. So, I wrote my own.
View it on Github - [Ubuntu-Docker-Compose-Starter-Pack](https://github.com/CT83/Ubuntu-Docker-Compose-Starter-Pack)
### 🐳
Note, this assumes that you have a gentle grasp of what Docker Compose and Containerization are, so stay put for the rodeo!
#### Components
1. Dockerfile
2. Docker Compose Configuration
3. Startup script#### 1. Dockerfile
Consider this a recipe that tells Docker how the image needs to be assembled.
Read More - [Here](https://docs.docker.com/engine/reference/builder/)
```
FROM ubuntu:latestCOPY . ./start_script.sh
RUN ["chmod", "+x", "start_script.sh"]ENTRYPOINT ["sh","./start_script.sh"]
```Here, we pull the latest ubuntu image from Docker Hub and copy over the startup script (and make it executable) which will be run when the container is initialized, more on this later.
#### 2. Docker Compose Configuration
A Docker Compose Configuration file or .yml file tells docker how many and what containers we are trying to spin up, what volumes need to be mounted and what environment variables need to be defined.
Read More - [Here](https://docs.docker.com/compose/compose-file/)
```
version: "3.3"services:
hello_container:
container_name: hello_contaier
build: .volumes:
- ./data:/mnt/data
- ./data2:/mnt/data2environment:
SYS_NAME: good-containervolumes:
data :
data2 :
```Here, we are declaring the container which we plan to use, it's name, volumes which we plan to mount and environment variables we want to use.
#### 3. Startup Script
This is the file that will be run when the container is created, all the commands your servers, startup scripts should go in here.
```
#!/bin/bashecho "Hello World! This is the Ubuntu Container!"
```### That's it!
#### Spinning up the containers
Once you have docker and docker-compose installed you can simply do
`docker-compose up --build`
to start everything!
View it on Github - [Ubuntu-Docker-Compose-Starter-Pack](https://github.com/CT83/Ubuntu-Docker-Compose-Starter-Pack)