Activating a conda env inside a Docker container when using docker-compose to start Jupyter notebook












0














I have the following Dockerfile.



FROM continuumio/miniconda3:4.5.11

# create a new user (defaults to 'al-khawarizmi')
USER root
ARG username=al-khawarizmi
RUN useradd --create-home --home-dir /home/${username} ${username}
ENV HOME /home/${username}

# switch to newly created user to avoid running container as root
USER ${username}
WORKDIR $HOME

# build and activate the specified conda environment from a file (defaults to 'environment.yml')
ARG environment=environment.yml
COPY ${environment} .
RUN conda env create --file ${environment} &&
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc &&
echo "conda activate $(head -1 ${environment} | cut -d' ' -f2)" >> ~/.bashrc


The Dockerfile allows the user to specify a conda environment file as a build arg. Here would be a typical environment.yml file.



name: nessie-py

channels:
- conda-forge
- defaults

dependencies:
- python=3.6
- "notebook=5.7.*"
- "matplotlib=3.0.*"
- "numpy=1.15.*"
- "pandas=0.23.*"


The user can run the image in the standard way and the conda environment will be automatically activated. Running



$ docker run -it image_name:image_tag


yields a bash prompt within the Docker container with the conda environment activated.



(environment_name)$


Now I would like to use docker-compose to start a Jupyter notebook server within the container (built with a conda environment file specifying Jupyter as a dependency).



When I use the following docker-compose.yml



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi
command: jupyter notebook --no-browser ip=0.0.0.0


I get the following error.



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | [FATAL tini (7)] exec jupyter failed: No such file or directory
nessie-py_notebook-server_1 exited with code 127


I suspected that this error meant that the conda environment is not activated. I then tried adding tty: true and stdin_open: true to the docker-compose.yml thinking that this should invoke and interactive bash prompt prior to running the command. This resulted in the same error as above.



I also tried defining a start-notebook.sh script that explicitly activates the conda environment prior to running the notebook.



#!/bin/bash
set -e

# activate the environment and start the notebook
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


results in a different error



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 |
notebook-server_1 | CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
notebook-server_1 | If your shell is Bash or a Bourne variant, enable conda for the current user with
notebook-server_1 |
notebook-server_1 | $ echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | or, for all users, enable conda with
notebook-server_1 |
notebook-server_1 | $ sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
notebook-server_1 |
notebook-server_1 | The options above will permanently enable the 'conda' command, but they do NOT
notebook-server_1 | put conda's base (root) environment on PATH. To do so, run
notebook-server_1 |
notebook-server_1 | $ conda activate
notebook-server_1 |
notebook-server_1 | in your terminal, or to put the base environment on PATH permanently, run
notebook-server_1 |
notebook-server_1 | $ echo "conda activate" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
notebook-server_1 | your ~/.bashrc file. You should manually remove the line that looks like
notebook-server_1 |
notebook-server_1 | export PATH="/opt/conda/bin:$PATH"
notebook-server_1 |
notebook-server_1 | ^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
notebook-server_1 |
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


This error suggests that bash is not sourcing ~/.bashrc prior to running the script.



I tried explicitly sourcing /opt/conda/etc/profile.d/conda.sh prior to activating the conda environment.



#!/bin/bash
set -e

# activate the environment and start the notebook
. /opt/conda/etc/profile.d/conda.sh
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


which results in a different error!



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | Could not find conda environment: nessie-py
notebook-server_1 | You can list all discoverable environments with `conda info --envs`.
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


I can check to see which conda envs are discoverable in the container by running



$ docker run -it nessie-py conda info --envs


which says that the environment does indeed exist.



$ docker run -it nessie-py_notebook-server conda info --envs
# conda environments:
#
nessie-py /home/al-khawarizmi/.conda/envs/nessie-py
base * /opt/conda


I am out of ideas at this point. This should be possible. Here is an example of a project with a docker-compose.yml file, a Dockerfile that specifies a conda environment and starts a Jupyter notebook server.



The additional complexities that I need include adding a non-root user to the Dockerfile and creating a new conda environment instead of updating the default base conda environment.










share|improve this question
























  • can you post the contents of your environment.yml?
    – fernandezcuesta
    Nov 12 '18 at 13:24










  • Added a stub environment.yml file.
    – davidrpugh
    Nov 13 '18 at 5:11










  • looks to me that the error comes from the ip=0.0.0.0 argument, which should be --ip=0.0.0.0 instead.
    – fernandezcuesta
    Nov 13 '18 at 10:58












  • @fernandezcuesta thanks for catching the typo! But this doesn't not impact any of the error messages that I am receiving. The key problem seems to be in activating the conda environment.
    – davidrpugh
    Nov 14 '18 at 9:02
















0














I have the following Dockerfile.



FROM continuumio/miniconda3:4.5.11

# create a new user (defaults to 'al-khawarizmi')
USER root
ARG username=al-khawarizmi
RUN useradd --create-home --home-dir /home/${username} ${username}
ENV HOME /home/${username}

# switch to newly created user to avoid running container as root
USER ${username}
WORKDIR $HOME

# build and activate the specified conda environment from a file (defaults to 'environment.yml')
ARG environment=environment.yml
COPY ${environment} .
RUN conda env create --file ${environment} &&
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc &&
echo "conda activate $(head -1 ${environment} | cut -d' ' -f2)" >> ~/.bashrc


The Dockerfile allows the user to specify a conda environment file as a build arg. Here would be a typical environment.yml file.



name: nessie-py

channels:
- conda-forge
- defaults

dependencies:
- python=3.6
- "notebook=5.7.*"
- "matplotlib=3.0.*"
- "numpy=1.15.*"
- "pandas=0.23.*"


The user can run the image in the standard way and the conda environment will be automatically activated. Running



$ docker run -it image_name:image_tag


yields a bash prompt within the Docker container with the conda environment activated.



(environment_name)$


Now I would like to use docker-compose to start a Jupyter notebook server within the container (built with a conda environment file specifying Jupyter as a dependency).



When I use the following docker-compose.yml



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi
command: jupyter notebook --no-browser ip=0.0.0.0


I get the following error.



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | [FATAL tini (7)] exec jupyter failed: No such file or directory
nessie-py_notebook-server_1 exited with code 127


I suspected that this error meant that the conda environment is not activated. I then tried adding tty: true and stdin_open: true to the docker-compose.yml thinking that this should invoke and interactive bash prompt prior to running the command. This resulted in the same error as above.



I also tried defining a start-notebook.sh script that explicitly activates the conda environment prior to running the notebook.



#!/bin/bash
set -e

# activate the environment and start the notebook
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


results in a different error



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 |
notebook-server_1 | CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
notebook-server_1 | If your shell is Bash or a Bourne variant, enable conda for the current user with
notebook-server_1 |
notebook-server_1 | $ echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | or, for all users, enable conda with
notebook-server_1 |
notebook-server_1 | $ sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
notebook-server_1 |
notebook-server_1 | The options above will permanently enable the 'conda' command, but they do NOT
notebook-server_1 | put conda's base (root) environment on PATH. To do so, run
notebook-server_1 |
notebook-server_1 | $ conda activate
notebook-server_1 |
notebook-server_1 | in your terminal, or to put the base environment on PATH permanently, run
notebook-server_1 |
notebook-server_1 | $ echo "conda activate" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
notebook-server_1 | your ~/.bashrc file. You should manually remove the line that looks like
notebook-server_1 |
notebook-server_1 | export PATH="/opt/conda/bin:$PATH"
notebook-server_1 |
notebook-server_1 | ^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
notebook-server_1 |
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


This error suggests that bash is not sourcing ~/.bashrc prior to running the script.



I tried explicitly sourcing /opt/conda/etc/profile.d/conda.sh prior to activating the conda environment.



#!/bin/bash
set -e

# activate the environment and start the notebook
. /opt/conda/etc/profile.d/conda.sh
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


which results in a different error!



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | Could not find conda environment: nessie-py
notebook-server_1 | You can list all discoverable environments with `conda info --envs`.
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


I can check to see which conda envs are discoverable in the container by running



$ docker run -it nessie-py conda info --envs


which says that the environment does indeed exist.



$ docker run -it nessie-py_notebook-server conda info --envs
# conda environments:
#
nessie-py /home/al-khawarizmi/.conda/envs/nessie-py
base * /opt/conda


I am out of ideas at this point. This should be possible. Here is an example of a project with a docker-compose.yml file, a Dockerfile that specifies a conda environment and starts a Jupyter notebook server.



The additional complexities that I need include adding a non-root user to the Dockerfile and creating a new conda environment instead of updating the default base conda environment.










share|improve this question
























  • can you post the contents of your environment.yml?
    – fernandezcuesta
    Nov 12 '18 at 13:24










  • Added a stub environment.yml file.
    – davidrpugh
    Nov 13 '18 at 5:11










  • looks to me that the error comes from the ip=0.0.0.0 argument, which should be --ip=0.0.0.0 instead.
    – fernandezcuesta
    Nov 13 '18 at 10:58












  • @fernandezcuesta thanks for catching the typo! But this doesn't not impact any of the error messages that I am receiving. The key problem seems to be in activating the conda environment.
    – davidrpugh
    Nov 14 '18 at 9:02














0












0








0







I have the following Dockerfile.



FROM continuumio/miniconda3:4.5.11

# create a new user (defaults to 'al-khawarizmi')
USER root
ARG username=al-khawarizmi
RUN useradd --create-home --home-dir /home/${username} ${username}
ENV HOME /home/${username}

# switch to newly created user to avoid running container as root
USER ${username}
WORKDIR $HOME

# build and activate the specified conda environment from a file (defaults to 'environment.yml')
ARG environment=environment.yml
COPY ${environment} .
RUN conda env create --file ${environment} &&
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc &&
echo "conda activate $(head -1 ${environment} | cut -d' ' -f2)" >> ~/.bashrc


The Dockerfile allows the user to specify a conda environment file as a build arg. Here would be a typical environment.yml file.



name: nessie-py

channels:
- conda-forge
- defaults

dependencies:
- python=3.6
- "notebook=5.7.*"
- "matplotlib=3.0.*"
- "numpy=1.15.*"
- "pandas=0.23.*"


The user can run the image in the standard way and the conda environment will be automatically activated. Running



$ docker run -it image_name:image_tag


yields a bash prompt within the Docker container with the conda environment activated.



(environment_name)$


Now I would like to use docker-compose to start a Jupyter notebook server within the container (built with a conda environment file specifying Jupyter as a dependency).



When I use the following docker-compose.yml



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi
command: jupyter notebook --no-browser ip=0.0.0.0


I get the following error.



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | [FATAL tini (7)] exec jupyter failed: No such file or directory
nessie-py_notebook-server_1 exited with code 127


I suspected that this error meant that the conda environment is not activated. I then tried adding tty: true and stdin_open: true to the docker-compose.yml thinking that this should invoke and interactive bash prompt prior to running the command. This resulted in the same error as above.



I also tried defining a start-notebook.sh script that explicitly activates the conda environment prior to running the notebook.



#!/bin/bash
set -e

# activate the environment and start the notebook
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


results in a different error



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 |
notebook-server_1 | CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
notebook-server_1 | If your shell is Bash or a Bourne variant, enable conda for the current user with
notebook-server_1 |
notebook-server_1 | $ echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | or, for all users, enable conda with
notebook-server_1 |
notebook-server_1 | $ sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
notebook-server_1 |
notebook-server_1 | The options above will permanently enable the 'conda' command, but they do NOT
notebook-server_1 | put conda's base (root) environment on PATH. To do so, run
notebook-server_1 |
notebook-server_1 | $ conda activate
notebook-server_1 |
notebook-server_1 | in your terminal, or to put the base environment on PATH permanently, run
notebook-server_1 |
notebook-server_1 | $ echo "conda activate" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
notebook-server_1 | your ~/.bashrc file. You should manually remove the line that looks like
notebook-server_1 |
notebook-server_1 | export PATH="/opt/conda/bin:$PATH"
notebook-server_1 |
notebook-server_1 | ^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
notebook-server_1 |
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


This error suggests that bash is not sourcing ~/.bashrc prior to running the script.



I tried explicitly sourcing /opt/conda/etc/profile.d/conda.sh prior to activating the conda environment.



#!/bin/bash
set -e

# activate the environment and start the notebook
. /opt/conda/etc/profile.d/conda.sh
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


which results in a different error!



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | Could not find conda environment: nessie-py
notebook-server_1 | You can list all discoverable environments with `conda info --envs`.
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


I can check to see which conda envs are discoverable in the container by running



$ docker run -it nessie-py conda info --envs


which says that the environment does indeed exist.



$ docker run -it nessie-py_notebook-server conda info --envs
# conda environments:
#
nessie-py /home/al-khawarizmi/.conda/envs/nessie-py
base * /opt/conda


I am out of ideas at this point. This should be possible. Here is an example of a project with a docker-compose.yml file, a Dockerfile that specifies a conda environment and starts a Jupyter notebook server.



The additional complexities that I need include adding a non-root user to the Dockerfile and creating a new conda environment instead of updating the default base conda environment.










share|improve this question















I have the following Dockerfile.



FROM continuumio/miniconda3:4.5.11

# create a new user (defaults to 'al-khawarizmi')
USER root
ARG username=al-khawarizmi
RUN useradd --create-home --home-dir /home/${username} ${username}
ENV HOME /home/${username}

# switch to newly created user to avoid running container as root
USER ${username}
WORKDIR $HOME

# build and activate the specified conda environment from a file (defaults to 'environment.yml')
ARG environment=environment.yml
COPY ${environment} .
RUN conda env create --file ${environment} &&
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc &&
echo "conda activate $(head -1 ${environment} | cut -d' ' -f2)" >> ~/.bashrc


The Dockerfile allows the user to specify a conda environment file as a build arg. Here would be a typical environment.yml file.



name: nessie-py

channels:
- conda-forge
- defaults

dependencies:
- python=3.6
- "notebook=5.7.*"
- "matplotlib=3.0.*"
- "numpy=1.15.*"
- "pandas=0.23.*"


The user can run the image in the standard way and the conda environment will be automatically activated. Running



$ docker run -it image_name:image_tag


yields a bash prompt within the Docker container with the conda environment activated.



(environment_name)$


Now I would like to use docker-compose to start a Jupyter notebook server within the container (built with a conda environment file specifying Jupyter as a dependency).



When I use the following docker-compose.yml



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi
command: jupyter notebook --no-browser ip=0.0.0.0


I get the following error.



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | [FATAL tini (7)] exec jupyter failed: No such file or directory
nessie-py_notebook-server_1 exited with code 127


I suspected that this error meant that the conda environment is not activated. I then tried adding tty: true and stdin_open: true to the docker-compose.yml thinking that this should invoke and interactive bash prompt prior to running the command. This resulted in the same error as above.



I also tried defining a start-notebook.sh script that explicitly activates the conda environment prior to running the notebook.



#!/bin/bash
set -e

# activate the environment and start the notebook
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


results in a different error



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 |
notebook-server_1 | CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
notebook-server_1 | If your shell is Bash or a Bourne variant, enable conda for the current user with
notebook-server_1 |
notebook-server_1 | $ echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | or, for all users, enable conda with
notebook-server_1 |
notebook-server_1 | $ sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
notebook-server_1 |
notebook-server_1 | The options above will permanently enable the 'conda' command, but they do NOT
notebook-server_1 | put conda's base (root) environment on PATH. To do so, run
notebook-server_1 |
notebook-server_1 | $ conda activate
notebook-server_1 |
notebook-server_1 | in your terminal, or to put the base environment on PATH permanently, run
notebook-server_1 |
notebook-server_1 | $ echo "conda activate" >> ~/.bashrc
notebook-server_1 |
notebook-server_1 | Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
notebook-server_1 | your ~/.bashrc file. You should manually remove the line that looks like
notebook-server_1 |
notebook-server_1 | export PATH="/opt/conda/bin:$PATH"
notebook-server_1 |
notebook-server_1 | ^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
notebook-server_1 |
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


This error suggests that bash is not sourcing ~/.bashrc prior to running the script.



I tried explicitly sourcing /opt/conda/etc/profile.d/conda.sh prior to activating the conda environment.



#!/bin/bash
set -e

# activate the environment and start the notebook
. /opt/conda/etc/profile.d/conda.sh
conda activate nessie-py
jupyter notebook --no-browser ip=0.0.0.0


which results in a different error!



$ docker-compose up
Creating network "nessie-py_default" with the default driver
Creating nessie-py_notebook-server_1 ... done
Attaching to nessie-py_notebook-server_1
notebook-server_1 | Could not find conda environment: nessie-py
notebook-server_1 | You can list all discoverable environments with `conda info --envs`.
notebook-server_1 |
nessie-py_notebook-server_1 exited with code 1


I can check to see which conda envs are discoverable in the container by running



$ docker run -it nessie-py conda info --envs


which says that the environment does indeed exist.



$ docker run -it nessie-py_notebook-server conda info --envs
# conda environments:
#
nessie-py /home/al-khawarizmi/.conda/envs/nessie-py
base * /opt/conda


I am out of ideas at this point. This should be possible. Here is an example of a project with a docker-compose.yml file, a Dockerfile that specifies a conda environment and starts a Jupyter notebook server.



The additional complexities that I need include adding a non-root user to the Dockerfile and creating a new conda environment instead of updating the default base conda environment.







python docker docker-compose conda






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 5:11







davidrpugh

















asked Nov 12 '18 at 12:07









davidrpughdavidrpugh

1,64811532




1,64811532












  • can you post the contents of your environment.yml?
    – fernandezcuesta
    Nov 12 '18 at 13:24










  • Added a stub environment.yml file.
    – davidrpugh
    Nov 13 '18 at 5:11










  • looks to me that the error comes from the ip=0.0.0.0 argument, which should be --ip=0.0.0.0 instead.
    – fernandezcuesta
    Nov 13 '18 at 10:58












  • @fernandezcuesta thanks for catching the typo! But this doesn't not impact any of the error messages that I am receiving. The key problem seems to be in activating the conda environment.
    – davidrpugh
    Nov 14 '18 at 9:02


















  • can you post the contents of your environment.yml?
    – fernandezcuesta
    Nov 12 '18 at 13:24










  • Added a stub environment.yml file.
    – davidrpugh
    Nov 13 '18 at 5:11










  • looks to me that the error comes from the ip=0.0.0.0 argument, which should be --ip=0.0.0.0 instead.
    – fernandezcuesta
    Nov 13 '18 at 10:58












  • @fernandezcuesta thanks for catching the typo! But this doesn't not impact any of the error messages that I am receiving. The key problem seems to be in activating the conda environment.
    – davidrpugh
    Nov 14 '18 at 9:02
















can you post the contents of your environment.yml?
– fernandezcuesta
Nov 12 '18 at 13:24




can you post the contents of your environment.yml?
– fernandezcuesta
Nov 12 '18 at 13:24












Added a stub environment.yml file.
– davidrpugh
Nov 13 '18 at 5:11




Added a stub environment.yml file.
– davidrpugh
Nov 13 '18 at 5:11












looks to me that the error comes from the ip=0.0.0.0 argument, which should be --ip=0.0.0.0 instead.
– fernandezcuesta
Nov 13 '18 at 10:58






looks to me that the error comes from the ip=0.0.0.0 argument, which should be --ip=0.0.0.0 instead.
– fernandezcuesta
Nov 13 '18 at 10:58














@fernandezcuesta thanks for catching the typo! But this doesn't not impact any of the error messages that I am receiving. The key problem seems to be in activating the conda environment.
– davidrpugh
Nov 14 '18 at 9:02




@fernandezcuesta thanks for catching the typo! But this doesn't not impact any of the error messages that I am receiving. The key problem seems to be in activating the conda environment.
– davidrpugh
Nov 14 '18 at 9:02












1 Answer
1






active

oldest

votes


















0














What happens is consequence of:




  1. In the docker-compose.yml you've a typo in ip=0.0.0.0 which should be --ip=0.0.0.0 instead


  2. Binding the host's folder into the container is overriding .bashrc. An easy change would be mounting into a subdirectory


  3. You need to run bash in interactive mode (-i) so that .bashrc is properly read



As an example, changes on these points reflected in yourdocker-compose.yml:



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi/hosthome
command: bash -ic 'jupyter notebook --no-browser --ip=0.0.0.0'





share|improve this answer























  • How did you figure out that binding the host's folder into the container is overriding .bashrc?
    – davidrpugh
    Nov 15 '18 at 6:01










  • it is described in docker documentation
    – fernandezcuesta
    Nov 15 '18 at 10:07











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261888%2factivating-a-conda-env-inside-a-docker-container-when-using-docker-compose-to-st%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














What happens is consequence of:




  1. In the docker-compose.yml you've a typo in ip=0.0.0.0 which should be --ip=0.0.0.0 instead


  2. Binding the host's folder into the container is overriding .bashrc. An easy change would be mounting into a subdirectory


  3. You need to run bash in interactive mode (-i) so that .bashrc is properly read



As an example, changes on these points reflected in yourdocker-compose.yml:



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi/hosthome
command: bash -ic 'jupyter notebook --no-browser --ip=0.0.0.0'





share|improve this answer























  • How did you figure out that binding the host's folder into the container is overriding .bashrc?
    – davidrpugh
    Nov 15 '18 at 6:01










  • it is described in docker documentation
    – fernandezcuesta
    Nov 15 '18 at 10:07
















0














What happens is consequence of:




  1. In the docker-compose.yml you've a typo in ip=0.0.0.0 which should be --ip=0.0.0.0 instead


  2. Binding the host's folder into the container is overriding .bashrc. An easy change would be mounting into a subdirectory


  3. You need to run bash in interactive mode (-i) so that .bashrc is properly read



As an example, changes on these points reflected in yourdocker-compose.yml:



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi/hosthome
command: bash -ic 'jupyter notebook --no-browser --ip=0.0.0.0'





share|improve this answer























  • How did you figure out that binding the host's folder into the container is overriding .bashrc?
    – davidrpugh
    Nov 15 '18 at 6:01










  • it is described in docker documentation
    – fernandezcuesta
    Nov 15 '18 at 10:07














0












0








0






What happens is consequence of:




  1. In the docker-compose.yml you've a typo in ip=0.0.0.0 which should be --ip=0.0.0.0 instead


  2. Binding the host's folder into the container is overriding .bashrc. An easy change would be mounting into a subdirectory


  3. You need to run bash in interactive mode (-i) so that .bashrc is properly read



As an example, changes on these points reflected in yourdocker-compose.yml:



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi/hosthome
command: bash -ic 'jupyter notebook --no-browser --ip=0.0.0.0'





share|improve this answer














What happens is consequence of:




  1. In the docker-compose.yml you've a typo in ip=0.0.0.0 which should be --ip=0.0.0.0 instead


  2. Binding the host's folder into the container is overriding .bashrc. An easy change would be mounting into a subdirectory


  3. You need to run bash in interactive mode (-i) so that .bashrc is properly read



As an example, changes on these points reflected in yourdocker-compose.yml:



version: "3.7"

services:
notebook-server:
build:
context: ./
ports:
- "8888:8888"
volumes:
- ./:/home/al-khawarizmi/hosthome
command: bash -ic 'jupyter notebook --no-browser --ip=0.0.0.0'






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 14 '18 at 14:01

























answered Nov 14 '18 at 13:18









fernandezcuestafernandezcuesta

1,551817




1,551817












  • How did you figure out that binding the host's folder into the container is overriding .bashrc?
    – davidrpugh
    Nov 15 '18 at 6:01










  • it is described in docker documentation
    – fernandezcuesta
    Nov 15 '18 at 10:07


















  • How did you figure out that binding the host's folder into the container is overriding .bashrc?
    – davidrpugh
    Nov 15 '18 at 6:01










  • it is described in docker documentation
    – fernandezcuesta
    Nov 15 '18 at 10:07
















How did you figure out that binding the host's folder into the container is overriding .bashrc?
– davidrpugh
Nov 15 '18 at 6:01




How did you figure out that binding the host's folder into the container is overriding .bashrc?
– davidrpugh
Nov 15 '18 at 6:01












it is described in docker documentation
– fernandezcuesta
Nov 15 '18 at 10:07




it is described in docker documentation
– fernandezcuesta
Nov 15 '18 at 10:07


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261888%2factivating-a-conda-env-inside-a-docker-container-when-using-docker-compose-to-st%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Full-time equivalent

Bicuculline

さくらももこ