Install the python container in docker I configured it in pycharm. enter image description here

Configured interpreter enter image description here

But I can not install the libraries in pycharm tried to install via the console:

pip install <имя библиотеки> 

The library was established successfully, but it is not visible. What am I doing wrong?

The container itself was put through kitematik, I also wanted to assemble the container myself without kitematik, but an error appears.

Dockerfile

  FROM python:3.6 ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code ADD requirements.txt /code/ RUN pip install -r requirements.txt ADD . /code/ 

requirements.txt

 pandas lxml cssselect XlsxWriter 

docker-compose.yml

  version: '2' services: db: image: postgres web: build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" depends_on: - db 

execute the command

 docker-compose run web startproject composeexample 

There is an error:

  PS D:\docker python> docker-compose run web startproject composeexample ERROR: Cannot create container for service web: D: drive is not shared. Please share it in Docker for Windows Settings 

removed the line began to get an error

 Removing intermediate container 1794eefd67fa Successfully built 145154c97b94 WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-co mpose build` or `docker-compose up --build`. Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"startp roject\": executable file not found in $PATH" 
  • What do you want to get? What is the desired behavior? - Mikhail Vaysman
  • I used the library to use this manual https://hub.docker.com/_/python/ - fermeg
  • This is a link not to the manual, but to an image with python. - Mikhail Vaysman
  • I put through kitematik, but the volume is not ready solutions that I need. - fermeg
  • I created my container, created Dockerfile, requirements.txt, docker-compose.yml I’m running it doesn’t write, I write the error 'PS D: \ docker python> docker-compose run web start compjectexample ERROR: Can not create container for service web: D: drive is not shared. Please share it in Docker for Windows Settin ' - fermeg

1 answer 1

The decision I do not know how much, it is perfect.

Dockerfile, requirements.txt, docker-compose.yml is above in question.

I execute the command:

 docker-compose run web composeexample 

An error occurs:

Removing intermediate container b44086c37a95 Successfully built 0fc23d053871 WARNING: To rebuild this image you must use docker-compose build or docker-compose up --build . Error response: daemon: oci runtime error: container_linux.go: 247: starting container process caused "exec: \" composeexample \ ": executable file not found in $ PATH"

I execute the command:

 docker-compose up --build 

It worked.

  • where did you get this docker-compose run web startproject composeexample command? - Mikhail Vaysman
  • removed startproject - fermeg
  • you just did not read to the end. this command to create a project. and to run the command at the very end. - Mikhail Vaysman
  • The --build key --build usually not needed. - Mikhail Vaysman