A console utility that allows you to easily create Dockerfile and docker-compose with a single command.
- Download
dockercli.exefrom Releases or source code - Create any directory and put this file to there (e.x.
C:\bin\dockercli.exe) - Press
Win + R, typesysdm.cpl, go toAdditionally, pressEnvironment Variables - In opened window find
Path->Edit->Createand press path todockercli.exe - Press
Okin all windows
Open command line or Windows PowerShell and type dockercli help for view list of all commands.
To create Dockerfile and docker-compose.yml in current directory, enter dockercli generate [FROM] (params). For example: dockercli g node --v21 --mysql --buildNode. Output:
# Dockerfile
FROM node:21
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
RUN npm run build
CMD ["node", "dist/main.js"]docker-compose.yml
version: '3.8'
services:
mysql:
image: mysql:8.0
command: --log-error-verbosity=2
restart: always
environment:
MYSQL_ROOT_PASSWORD: passroot
MYSQL_USER: msqluser
MYSQL_PASSWORD: msqlpass
MYSQL_DATABASE: app
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
interval: 5s
timeout: 10s
retries: 5
app:
depends_on:
mysql:
condition: service_healthy
build: .
tty: true
volumes:
mysql_data:node- NodeJSgcc- C compilerpython- Python
--v*- sets version ofFROM--mysql- adds MySQL image todocker-compose.yml--nasm- applies to gcc only. Will run .asm file via NASM--nodeBuild- addsRUN npm run buildin Dockerfile--force- overwrite currentDockerfileanddocker-compose.ymlif it exists--postgre- adds Postgres image todocker-compose.yml--mongodb- adds Mongo image todocker-compose.yml
DockerCLI can also work with templates. Templates are presented as JSON files with a certain structure. Below is this structure
some.json
{
"from": "ur_from",
"dockerfile": [
"WORKDIR /app",
"${variable}",
"CMD [\"Hello!\"]"
],
"variables": {
"variable": {
"true": "Value or values if specified",
"false": [
"Value or values",
"if not specified"
]
}
},
"options": {
"--someOption": "variable"
},
"compose": [
"version: '3.8'",
"${variable}",
"",
"services:",
" app:"
]
}If you type
dockercli some --someOption
Then you see:
Dockerfile
FROM ur_from:lasted
WORKDIR /app
Value or values if specified
CMD ["Hello!"]docker-compose.yml
version: '3.8'
Value or values if specified
services:
app:In templates, only --force and --v* work from standard options.