Root password inside a Docker container

You can log into the Docker container using the root user (ID = 0) instead of the provided default user when you use the -u option. E.g. docker exec -u 0 -it mycontainer bash root (id = 0) is the default user within a container. The image developer can create additional users. Those users are … Read more

Activate conda environment in docker

Followed this tutorial and it worked. Example Dockerfile: FROM continuumio/miniconda WORKDIR /usr/src/app COPY ./ ./ RUN conda env create -f environment.yml # Make RUN commands use the new environment: SHELL [“conda”, “run”, “-n”, “myenv”, “/bin/bash”, “-c”] EXPOSE 5003 # The code to run when container is started: ENTRYPOINT [“conda”, “run”, “-n”, “myenv”, “python3”, “src/server.py”] Update: … Read more

Copying files from Docker container to host

In order to copy a file from a container to the host, you can use the command docker cp <containerId>:/file/path/within/container /host/path/target Here’s an example: $ sudo docker cp goofy_roentgen:/out_read.jpg . Here goofy_roentgen is the container name I got from the following command: $ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1b4ad9311e93 … Read more

java.net.UnknownHostException on Docker

In my case the java application was failing with java.net.UnknownHostException when running in docker. The reason was that I used –network=none docker flag (getting ip/hostname via dhcp and pipework). In this case, docker does not add automatically to /etc/hosts entry like 127.0.0.1 15e326aecf84 And getCanonicalHostName() Java function threw this exception. Possible solutions: add hostname entry … Read more

org.openqa.selenium.NoSuchSessionException: Unable to find session with ID error testing with Behat/Mink and Selenium2Driver in docker container

This error message… org.openqa.selenium.NoSuchSessionException: Unable to find session with ID: url\n Build info: version: ‘4.0.0-alpha-6’, revision: ‘5f43a29cfc’\n System info: host: ‘fca78c7f81e6’, ip: ‘172.28.0.3’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘5.4.0-42-generic’, java.version: ‘1.8.0_252’\n Driver info: driver.version: unknown …implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session which gets reflected in … Read more