Cleanup Docker content

This commit is contained in:
James Skemp 2024-02-14 18:09:37 -06:00
parent 75424dfa5e
commit d903e08249
1 changed files with 0 additions and 219 deletions

View File

@ -108,222 +108,3 @@ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
# Test.
sudo docker run hello-world
```
docker pull ubuntu
docker run -it ubuntu
apt update
apt install nodejs
node -v
exit
docker commit -m "What you did to the image" -a "Author Name" container_id repository/new_image_name
docker commit -m "added Node.js" -a "sammy" d9b100f2f636 sammy/ubuntu-nodejs
docker images
docker login gitea.example.com
Images must follow this naming convention:
{registry}/{owner}/{image}
For example, these are all valid image names for the owner testuser:
gitea.example.com/testuser/myimage
gitea.example.com/testuser/my-image
gitea.example.com/testuser/my/image
docker push gitea.example.com/{owner}/{image}:{tag}
Parameter Description
owner The owner of the image.
image The name of the image.
tag The tag of the image.
For example:
docker push gitea.example.com/testuser/myimage:latest
docker pull gitea.example.com/{owner}/{image}:{tag}
sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
note UID (User ID) and GID (Group ID) numbers
UID 117
GID 122
mkdir gitea && cd gitea
nano docker-compose.yml
```yaml
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=[uid]
- USER_GID=[gid]
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /home/git/.ssh/:/data/git/.ssh
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "127.0.0.1:3000:3000"
- "127.0.0.1:2222:22"
```
- from gitea, docker-compose.yml
```yaml
version: "3"
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:1.20.1
container_name: gitea
environment:
- USER_UID=117
- USER_GID=122
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "8070:3000"
- "2227:22"
```
docker compose up -d
docker compose ps
docker compose logs
have not run, but should to see what happens
docker compose down
drone install:
https://docs.drone.io/server/provider/gitea/
1. `openssl rand -hex 16`
- 3f700dc23718a9e032b0baa2edc5a8f2
2. Create OAuth app in Gitea
- http://192.168.0.60:8070/admin/applications
- drone
- http://192.168.0.60:8071/login
- [x] Confidential Client
- client id: e9af28ea-34d8-469c-887d-fcb7b8b80da4
- client secret: gto_3mcdg6fv5ylza6i4oi7fgjpjustvxkdzfohkxognfvotqnzyzuia
3. Allow access to Gitea port via ufw: `sudo ufw allow 8070` (otherwise Drone will timeout during authorization)
- Also allow `8071` and `8075`.
4. Install docker (from `~`)
- `docker pull drone/drone:2`
```
docker run \
--volume=/var/lib/drone:/data \
--env=DRONE_GITEA_SERVER=http://192.168.0.60:8070 \
--env=DRONE_GITEA_CLIENT_ID=e9af28ea-34d8-469c-887d-fcb7b8b80da4 \
--env=DRONE_GITEA_CLIENT_SECRET=gto_3mcdg6fv5ylza6i4oi7fgjpjustvxkdzfohkxognfvotqnzyzuia \
--env=DRONE_RPC_SECRET=3f700dc23718a9e032b0baa2edc5a8f2 \
--env=DRONE_SERVER_HOST=192.168.0.60:8071 \
--env=DRONE_SERVER_PROTO=http \
--publish=8071:80 \
--publish=8072:443 \
--restart=always \
--detach=true \
--name=drone \
drone/drone:2
```
Fixed by ufw setting:
Post "http://192.168.0.60:8070/login/oauth/access_token": dial tcp 192.168.0.60:8070: connect: connection timed out
docker pull drone/drone-runner-docker:1
```
docker run --detach \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--env=DRONE_RPC_PROTO=http \
--env=DRONE_RPC_HOST=192.168.0.60:8071 \
--env=DRONE_RPC_SECRET=3f700dc23718a9e032b0baa2edc5a8f2 \
--env=DRONE_UI_USERNAME=root \
--env=DRONE_UI_PASSWORD=root \
--env=DRONE_RUNNER_CAPACITY=2 \
--env=DRONE_RUNNER_NAME=my-first-runner \
--publish=8075:3000 \
--restart=always \
--name=runner \
drone/drone-runner-docker:1
```
`docker logs runner` to verify it's running
`sudo vim docker/gitea/gitea/gitea/conf/app.ini`
- `repository` > `ENABLE_PUSH_CREATE_USER = true`
- `repository` > `ENABLE_PUSH_CREATE_ORG = true`
- `webhook` > `ALLOWED_HOST_LIST = private`
- the default is `external` which doesn't allow local ips
`docker restart gitea` (might not be the best way)
ssh james@192.168.0.60
ssh james@192.168.0.61
Grade region h4d kill.
james
Asdf1234.
https://192.168.0.61:9090/
http://192.168.0.60:8070/
http://192.168.0.60:8071/
http://192.168.0.60:8075/