ping: cannot resolve http://somesite.test/: Unknown host
ping http://somesite.test/
ping somesite.test
docker run --rm --add-host somesite.test:10.10.0.8 httpd ab -c 3 -n 20 somesite.test
cat docker-compose.yml
version: "3"
services:
nginx-server:
image: nginx
restart: always
ports:
- "8000:80"
volumes:
- ./src:/usr/share/nginx/html
networks:
default:
aliases:
- www.google.com
- bober.kurwa.pl
client:
restart: always
image: nginx
docker exec -ti tmp-client-1 /usr/bin/ping bober.kurwa.pl
python3 -m http.server --bind localhost 8008
ssh -R 9009:localhost:8008 my.server.name.tld
.ssh/config
+ на файерволле открыт соответствующий порт.GET
запрос,POST
.Если отправить через консоль wget или curlом, то - не правильно введена команда.
The following examples use httpie to execute API calls against Portainer.
# запустили на локалхосте на порту 8008
python3 -m http.server --bind localhost 8008
ssh -R 9009:localhost:8008 your-host.name
Host your-host.name
HostName your-host.name
User notroot
Port 4000
IdentityFile /home/you_user/.ssh/id_rsa
FROM ubuntu:xenial
RUN useradd -d /home/ubuntu -ms /bin/bash -g root -G sudo -p ubuntu ubuntu
RUN mkdir /opt/myvolume && chown ubuntu /opt/myvolume
WORKDIR /home/ubuntu
VOLUME /opt/myvolume
Как пробросить папку из контейнера в локальну папку?
-v /root/test:/root/test удаляет файлы внутри контейнера
Each of these is a single value, analogous to its docker run counterpart. Note that mac_address is a legacy option.
version: '3'
services:
bigbluebutton:
image: bigbluebutton/bigbluebutton
hostname: yourhostname
ports:
- "80:80"
expose:
- "1935/tcp"
- "5066/tcp"
- "2202"
как проще всего решить данную задачу?
location /new/app/path/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8000;
}
upstream backend {
server backend1.example.com weight=5;
server backend2.example.com:8080;
server unix:/tmp/backend3;
server backup1.example.com:8080 backup;
server backup2.example.com:8080 backup;
}
server {
location / {
proxy_pass http://backend;
}
}
version: "3.5"
services:
db:
build:
context: ./docker
dockerfile: postgresql.Dockerfile
env_file:
- .env
restart: always
volumes:
- postgres:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
redis:
env_file:
- .env
restart: always
image: redis:3.0
expose:
- "6379"
echo 'APP_ENV=docker' > .env
Database credentials and other sensitive information should not be committed to the repository. Those required settings should be outlined in .env.example
Passing environment variables via Docker can be problematic in production. A phpinfo() call may leak secrets by outputting environment variables. Consider mounting a .env volume or copying it to the container directly.
version: "3.5"
services:
db:
build:
context: ./db
dockerfile: postgresql.Dockerfile
env_file:
- .env
restart: always
volumes:
- postgres:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
web:
build: .
restart: always
env_file:
- .env
- secret.env
command: gunicorn --bind 0.0.0.0:8080 --user nginx you_proj.wsgi
volumes:
- django-static:/data
ports:
- "127.0.0.1:8080:8080"
volumes:
django-static:
postgres:
FROM python:3.6-alpine
RUN apk add build-base python-dev py-pip jpeg-dev zlib-dev
ENV LIBRARY_PATH=/lib:/usr/lib
WORKDIR /code
ADD requirements.txt /code/
RUN apk update
RUN apk upgrade
RUN apk --no-cache add \
python3 \
python3-dev \
postgresql-client \
postgresql-dev \
build-base \
gettext
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
RUN set -x ; \
addgroup -g 101 -S nginx ; \
adduser -u 101 -D -S -G nginx nginx && exit 0 ; exit 1
RUN mkdir -p /data/static/ && mkdir -p /data/media/
ADD . /code/
RUN /code/maxmind.sh
ENV PYTHONUNBUFFERED 1
docker exec -it container_name_1 python3 manage.py collectstatic --noinput
docker exec -it container_name_1 python3 manage.py migrate
docker-compose down
--force --volumes
--disable-partition-engine-check
to mysql section in docker-compose.yml
docker-compose up -d
to set it up in background.Error response from daemonЧто-то пошло не так.
docker run hello-world
запускается?docker run -d -p 80:80 webserver-image:v1
тут 80 портcurl localhost:8000
тут 8000 портversion: '3.5'
services:
postgres1:
image: postgres:9.6
environment:
POSTGRES_PASSWORD: example1
ports:
- "5000:5432"
postgres2:
image: postgres:9.6
environment:
POSTGRES_PASSWORD: example2
ports:
- "5001:5432"