初次尝试docker build

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# set alpine as the base image of the Dockerfile
FROM alpine:latest

# update the package repository and install Tor
RUN apk update && apk --no-cache add tor

# Copy over the torrc created above and set the owner to `tor`
COPY torrc /etc/tor/torrc
RUN chown -R tor /etc/tor

# Set `tor` as the default user during the container runtime
USER tor

# Set `tor` as the entrypoint for the image
ENTRYPOINT ["tor"]

1
2
3
4
5
6
7
8
9
10
11
version: '3.3'
services:
tor:
container_name: tor
restart: always
image: limour/tor

networks:
default:
external: true
name: sswitch
  • docker login -u username -p ‘password’

  • mkdir -p ~/app/tor && cd ~/app/tor && nano Dockerfile && nano docker-compose.yml

  • echo ‘SocksPort 0.0.0.0:9050’ > torrc

  • docker build -t limour/tor .

  • docker image ls grep limour/tor

  • sudo docker network create sswitch

  • sudo docker-compose up -d && sudo docker-compose logs

  • # sudo docker-compose down

  • sudo docker-compose logs tail

测试效果


初次尝试docker build
https://b.limour.top/2149.html
Author
Limour
Posted on
February 28, 2023
Licensed under