small devcontainer with git & docker cli
427
Minimal Ubuntu 22.04 sandbox container with git functionalities, with some simplified commands.
Functionality: minimal container with vim & git to work on docker images.
Use at own risk, as the username/pass are somewhat exposed in a credentials file.
At first start of the container, a credentials file will be created in your volume mounted to container path /mnt/repos
The container will be automatically stopped.
Complete the ".credentials.txt" file
No spaces
If there are symbols like $ in your user and/or pass, use single quotes.
Restart the container
Run the docker container and the generated ssh key will be in the docker log.
docker logs -f git
add this to your github.com account via Settings -> SSH and GPG keys
Now you can connect to the container:
docker exec -it git /bin/bash
and use commands gitpush & dockerpush
First, clone your git repository and edit/modify
git clone https://github.com/yourgituser/yourgitrepo
cd yourgitrepo
To enable large file storage:
git lfs install
git lfs track yourfolder/yourfileprefix*.extension
git add .gitattributes
To use 1 command to push to git:
gitpush [comment] [tag]
e.g.
gitpush
gitpush "upgraded python" 1.3
gitpush "adapted the README.md" main
Create your docker repository on the docker hub.
After that you can build + push from this container
dockerpush <repository>[:tag]
e.g.
dockerpush yourdockerrepo
dockerpush yourdockerrepo:1.0
dockerpush yourdockerrepo:1.1 --purge-images
Or do it all at once with push
push <docker-repository>[:docker-tag]
e.g.
push yourdockerrepo:1.0
| Environment Variable | Key | Description |
|---|---|---|
| TZ | Europe/Brussels | timezone for ntpdate |
| .credentials.txt variable | Description |
|---|---|
| GITUSER | your github username / repository name |
| GITMAIL | your github email / signin account |
| DOCKERUSER | your docker user account |
| DOCKERPASS | your docker password |
| SSHPASS | openssh-server password |
| Volume | Container path |
|---|---|
| /host/folder/with/repos | /mnt/github |
| /var/run/docker.sock | /var/run/docker.sock |
Optionally exposed ssh port
| Host port | Container port |
|---|---|
| 1234 | 22 |
docker run -d --name='git' \
--net='bridge' \
-e TZ="Europe/Paris" \
-v '/path/on/host/':'/mnt/github':'rw' \
-v '/var/run/docker.sock':'/var/run/docker.sock':'rw' \
'insight4upublic/git'
github repo: https://github.com/Dedalus-Insight4U/docker-git
dockerhub repo: https://hub.docker.com/repository/docker/insight4upublic/git
log arrives in /var/log/git.log.
README.md will be updated on the docker hub using peterevans/dockerhub-description, so a shoutout to him!
Content type
Image
Digest
sha256:6fd50a621…
Size
332.6 MB
Last updated
about 1 year ago
docker pull insight4upublic/git