I want to create isolated environment to run modified python interpreter in it.
I have docker-compose.yaml:
version: '3.5'
services:
cpython:
image: ubuntu
ports:
- "7777:7777"
volumes:
- /home/myuser/workspace/cpython:/docker
working_dir: /docker
# stdin_open: true
# tty: true
command: /docker/python /docker/Tools/scripts/pydoc3 -p 7777
But when starting docker-compose up i get:
myuser#myuser-laptop:~/workspace/cpython$ docker-compose up
Recreating cpython_cpython_1 ...
Recreating cpython_cpython_1 ... done
Attaching to cpython_cpython_1
cpython_1 | Server ready at http://localhost:7777/
cpython_1 | Server commands: [b]rowser, [q]uit
cpython_1 | server>
cpython_1 | Server stopped
cpython_cpython_1 exited with code 0
Why command /docker/python /docker/Tools/scripts/pydoc3 -p 7777 is being stopped? In my host terminal it's working fine.
Looks like it's not opening an interactive terminal. Try:
docker run -it -p 7777:7777 -v /home/myuser/workspace/cpython:/docker ubuntu /docker/python /docker/Tools/scripts/pydoc3 -p 7777
Related
How can I check if my extra_hosts configuration is working?
version: '3.5'
services:
nginx:
image: nginx:stable
extra_hosts:
- "host.docker.internal:host-gateway"
I tried docker exec nginx /bin/sh -c 'ping host.docker.internal'
but got /bin/sh: 1: ping: not found
Is there some kind of ping alternative available in the nginx docker image?
Testing on Ubuntu 20.04.3 LTS host, with docker version 20.10.11 and docker-compose version 1.29.2.
nginx image does not come with ping command, you can add a busybox to test in and out:
cat << EOF > docker-compose.yaml
version: '3.5'
services:
nginx:
image: nginx:stable
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- 8080:80
busybox:
image: busybox
extra_hosts:
- "host.docker.internal:host-gateway"
command: ash -c 'sleep 3600'
EOF
docker-compose up -d
docker-compose exec busybox ping host.docker.internal
docker-compose exec busybox wget -qO- nginx
docker-compose exec busybox wget -qO- host.docker.internal:8080
docker-compose down
Always use sidecar container & do not overwhelm the main image:
k8s community provides a good image for network debugging which includes almost all famous CLIs : dig, nslookup, ping,.etc
k8s.gcr.io/e2e-test-images/jessie-dnsutils:1.3
Use it the same way the busybox way explained by gohm'c
I have two docker run commands as given below but I would like to merge these two commands together and execute it.
1st command - Start orthanc just with web viewer enabled
docker run -p 8042:8042 -e WVB_ENABLED=true osimis/orthanc
2nd command - Start Orthanc with mount directory tasks
docker run -p 4242:4242 -p 8042:8042 --rm --name orthanc -v
$(pwd)/orthanc/orthanc.json:/etc/orthanc/orthanc.json -v
$(pwd)/orthanc/orthanc-db:/var/lib/orthanc/db jodogne/orthanc-plugins
/etc/orthanc --verbose
As you can see, in both the cases the Orthanc is being started but I would like to merge these into one and start Orthanc. When it is started Web viewer should also be enabled and mount directory should also have happened
Can you let me know on how can this be done?
Use docker-compose, it is specially targeted for running multiple containers.
docker-compose.yml
version: '3'
services:
osimis:
image: osimis/orthanc
environment:
WVB_ENABLED: 'true'
ports:
- 8042:8042
orthanc:
image: jodogne/orthanc-plugins
environment:
WVB_ENABLED: 'true'
ports:
- 4242:4242
- 8042:8042
volumes:
- ./orthanc/orthanc.json:/etc/orthanc/orthanc.json
- ./orthanc/orthanc-db:/var/lib/orthanc/db
command: /etc/orthanc --verbose
and docker-compose up to finish the work
I've been trying to figure out why I cannot containers using "localhost:3000" from host. I've tried installing Docker via Homebrew, as well as the Docker for Mac installer. I believe I have the docker-compose file configured correctly.
Here is the output from docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------------------------------------
ecm-datacontroller_db_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp
ecm-datacontroller_kafka_1 supervisord -n Up 0.0.0.0:2181->2181/tcp, 0.0.0.0:9092->9092/tcp
ecm-datacontroller_redis_1 docker-entrypoint.sh redis ... Up 0.0.0.0:6379->6379/tcp
ecm-datacontroller_web_1 npm start Up 0.0.0.0:3000->3000/tcp
Here is my docker-compose.yml
version: '2'
services:
web:
ports:
- "3000:3000"
build: .
command: npm start
env_file: .env
depends_on:
- db
- redis
- kafka
volumes:
- .:/app/user
db:
image: postgres:latest
ports:
- "5432:5432"
redis:
image: redis:alpine
ports:
- "6379:6379"
kafka:
image: heroku/kafka
ports:
- "2181:2181"
- "9092:9092"
I cannot access any ports that are exposed by docker-compose with curl localhost:3000 I get the following result from that
curl: (52) Empty reply from server
I should be getting {"hello":"world"}.
Dockerfile:
FROM heroku/heroku:16-build
# Which version of node?
ENV NODE_ENGINE 10.15.0
# Locate our binaries
ENV PATH /app/heroku/node/bin/:/app/user/node_modules/.bin:$PATH
# Create some needed directories
RUN mkdir -p /app/heroku/node /app/.profile.d
WORKDIR /app/user
# Install node
RUN curl -s https://s3pository.heroku.com/node/v$NODE_ENGINE/node-v$NODE_ENGINE-linux-x64.tar.gz | tar --strip-components=1 -xz -C /app/heroku/node
# Export the node path in .profile.d
RUN echo "export PATH=\"/app/heroku/node/bin:/app/user/node_modules/.bin:\$PATH\"" > /app/.profile.d/nodejs.sh
ADD package.json /app/user/
RUN /app/heroku/node/bin/npm install
ADD . /app/user/
EXPOSE 3000
Anyone have any ideas?
Ultimately, I ended up having a service that was listening on 127.0.0.1 instead of 0.0.0.0. Updating this resolved the connectivity issue I was having.
I'm having problems with starting my containers via docker-compose up.
I guess this is an Windows problem, because my colleague owns a macbook and has now problems when he runs docker-compose up.
ERROR: for oracle-apex Cannot start service oracle-apex: oci runtime
error: container_linux.go:265: starting container process caused
"exec: \"/temp/entrypoint.sh\": stat /temp/entrypoint.sh: no such file
or directory"
The directory docker/apex/scripts does exists on my machine, isn't empty and contains the file entrypoint.sh.
I've found some similar problems when I've googled for this error, which told me to create a env file with COMPOSE_CONVERT_WINDOWS_PATHS=1, what I've done.
Versions:
Docker version 1.13.1, build 092cba3
docker-compose version 1.8.0,build unknown
Windows 10
docker-compose.yml
version: '2'
services:
proxy:
build: ./docker/proxy/
container_name: searchkit_proxy
ports:
- "8000:80"
volumes:
- ./docker/searchkit-v2/dist:/public/static
oracle-apex:
image: araczkowski/oracle-apex-ords
container_name: vanditmar-apex
volumes:
- ./docker/apex/scripts/:/temp/
ports:
- "49160:22"
- "8080:8080"
- "1521:1521"
entrypoint: ["/temp/entrypoint.sh"]
volumes:
esdata1:
driver: local
oracle-data:
driver: local
networks:
esnet:
Dockerfile in folder docker/apex/
FROM araczkowski/oracle-apex-ords
ADD ./scripts/ /temp/
RUN /temp/install.sh
entrypoint.sh
#!/bin/bash
exec >> >(tee -ai /docker_log.txt)
exec 2>&1
# # Update hostname
sed -i -E "s/HOST = [^)]+/HOST = $HOSTNAME/g" /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
sed -i -E "s/HOST = [^)]+/HOST = $HOSTNAME/g" /u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora
sed -i -E "s/PORT = [^)]+/PORT = 1521/g" /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
#
/etc/init.d/oracle-xe start
/etc/init.d/tomcat start
/etc/init.d/ssh start
/temp/install.sh
##
## Workaround for graceful shutdown. ....ing oracle... ‿( ́ ̵ _-`)‿
##
while [ "$END" == '' ]; do
sleep 1
trap "/etc/init.d/oracle-xe stop && END=1" INT TERM
done
;;
I'm new to docker, but I would like to know how to fix this problem. We think the problem is that the paths to the files are different on windows.
I use Bash on Ubuntu on Windows as command line. If there is any information missing please tell me, so I can add it :)
I'm running several containers in daemon mode: docker-compose up -d.
One of them recently crashed.
I'd like to investigate what happened. Where can I find the app logs?
Here's the docker-compose.yml (nothing special regarding logging):
mongodb:
image: mongo
command: "--smallfiles --logpath=/dev/null"
web:
build: .
command: npm start
volumes:
- .:/myapp
ports:
- "3001:3000"
links:
- mongodb
environment:
PORT: 3000
NODE_ENV: 'production'
seed:
build: ./seed
links:
- mongodb
You can get logs via docker-compose logs or you could exec to attach (docker >= 1.3) to the running instance via
$ docker exec -i -t 6655b41beef /bin/bash #by ID
or
$ docker exec -i -t my_www /bin/bash #by Name