# Pkg: not sure whats going on

**URL:** https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071
**Category:** General Usage
**Tags:** package, pkg, docker
**Created:** [November 11, 2023, 10:45am UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071 "2023-11-11T10:45:42Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![roh\_codeur](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@roh\_codeur](https://discourse.julialang.org/u/roh_codeur)
#### Post date: [November 11, 2023, 10:45am UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/1 "2023-11-11T10:45:43Z")

</div>

Hi

I have a dockerfile with the below lines:

```julia
WORKDIR /data/code/Olorin/
ENV JULIA_PROJECT="/data/code/Olorin/"
RUN cd /data/code/Olorin/ && \
    julia --project="/data/code/Olorin" -e 'using Pkg; Pkg.instantiate()' > /tmp/pkg_instantiate.log 2>&1
RUN ["julia", "-e", "using Pkg; Pkg.instantiate()"]

```

it doesn’t install packages. the log file has the below lines. If I logon to the server manually and check, I can see that it has activated the project, but not downloaded/installed any packages

```julia
  Installing known registries into `~/.julia`
  No Changes to `/data/code/Olorin/Project.toml`
  No Changes to `/data/code/Olorin/Manifest.toml`

```

if, I however, run the below command manually or as part of shell file:

```julia
cd /data/code/Olorin/
julia -e 'using Pkg; Pkg.instantiate()'

```

I can see it installs all packages. I am very confused! can someone help with this

Ta!

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [November 13, 2023, 7:23am UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/2 "2023-11-13T07:23:48Z")

</div>

Hello, @roh_codeur,

It would help us find the error if you included the entire dockerfile, not just a snippet. It should work as you described, I have a bunch of similarly working dockerfiles, too.

---

<div class="post-metadata">

### Author: ![roh\_codeur](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@roh\_codeur](https://discourse.julialang.org/u/roh_codeur)
#### Post date: [November 15, 2023, 9:14am UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/3 "2023-11-15T09:14:33Z")

</div>

thanks for the response @HanD. Here you go. I have copied both the docker compose and the DockerFile. you will notice that I have tried different ways to install Packages, none seem to work. however, when I attach shell to the container, I can run the same commands successfully. I am sure I am doing something silly.

docker-compose-uat.yml

```julia
services:
  workspace:
    build: .
    container_name: uat
    volumes:
      - ./deploy/uat/Olorin:/data/code/Olorin

```

Dockerfile

```julia
# Use a base image with a Linux distribution
FROM ubuntu:latest

SHELL ["/bin/bash", "-c"]

COPY install/docker-entrypoint.sh /data/deploy/

RUN apt-get update && \
    apt-get install -y wget && \
    apt-get install unzip
RUN apt-get update && apt-get -y install libgconf-2-4
RUN apt --fix-broken install
RUN echo " ******************************INSTALLING MINICONDA******************************"
WORKDIR /apps/third-party

ENV PATH="/apps/third-party/miniconda3/bin:${PATH}"
ARG PATH="/apps/third-party/miniconda3/bin:${PATH}"
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh \
    && bash Miniconda3-latest-Linux-aarch64.sh -b -u -p miniconda3 \
    && rm Miniconda3-latest-Linux-aarch64.sh \
    && miniconda3/bin/conda init bash \
    && source /root/.bashrc
RUN conda --version
RUN mkdir -p /data/deploy
COPY install/requirements.txt /data/deploy/
RUN pip install -r /data/deploy/requirements.txt
RUN echo " ******************************DONE INSTALLING MINICONDA******************************"

RUN echo " ******************************INSTALLING JULIA******************************"
WORKDIR /apps/third-party
RUN wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.9/julia-1.9.3-linux-aarch64.tar.gz && \
    tar -xvf julia-1.9.3-linux-aarch64.tar.gz && \
    rm julia-1.9.3-linux-aarch64.tar.gz

RUN mkdir -p /root/.julia/config
COPY install/startup.jl /root/.julia/config/
ENV PATH=$PATH:/apps/third-party/julia-1.9.3/bin/

# Install Julia project dependencies and activate the environment
WORKDIR /data/code/Olorin/
ENV JULIA_PROJECT="/data/code/Olorin/"
RUN cd /data/code/Olorin/ && \
    julia --project="/data/code/Olorin" -e 'using Pkg; Pkg.instantiate()' > /tmp/pkg_instantiate.log 2>&1
RUN ["julia", "-e", "using Pkg; Pkg.instantiate()"]
RUN julia -e "using Pkg; Pkg.status()"
RUN julia -e 'ENV["PYTHON"] = "/apps/third-party/miniconda3/bin/python"; using Pkg; Pkg.build("PyCall")'
RUN echo " ******************************DONE INSTALLING JULIA******************************"

# ENTRYPOINT ["sh","/data/deploy/docker-entrypoint.sh"]

```

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [November 15, 2023, 11:12am UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/4 "2023-11-15T11:12:42Z")

</div>

Stupid reply from me. Back in the mists of time I debugged a problem with the Gridengine batch system - nothing related to Docker.  
There are differences between interactive and non-interactive shells.  
Clearly when you shell into a Docker container you get an interactive shell.  
When you are running the commands is there a difference in the shell environment?

The only diagnostic I can think is running the command ‘env’ in the dockerfile and via the shell. Then compare the results minutely - vimdiff is good for this.

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [November 15, 2023, 12:58pm UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/5 "2023-11-15T12:58:55Z")

</div>

I see where the problem is. Your Dockerfile doesn’t contain the Julia project code. When you _build_ your docker image, there is no project, no `Project.toml`, no `Manifest.toml`, so no pakcages are installed. However, when you _run_ your container (via `docker compose`), the project root (`/data/code/Olorin/`) is mounted from a volume, so it will contain whatever you copied in that volume. That’s why when you log in to the service, your project files are already there, and you can install packages from Julia as expected.

If you want your image to contain preinstalled and precompiled dependencies, you need to copy at least the `Project.toml` file into the image at build time, in your Dockerfile, via `COPY`.

HTH.

Also, I recommend starting with a julia base image, rather than a generic ubuntu image. E.g., [`julia:1.9-alpine`](https://hub.docker.com/layers/library/julia/1.9-alpine/images/sha256-78b94bed175f3b035aaeed1682d7579f85d9b25daa4fb74d2ea8c2f5b5139e20?context=explore) or [`julia:1.9-bookworm`](https://hub.docker.com/layers/library/julia/1.9-bookworm/images/sha256-d6109e629b8d1cd362e9376666654ef51f58efd78d2ebb16ff289ceef281a10d?context=explore), if you perfer debian and `apt`. Ubuntu based images are most probably an overkill for this purpose.

---

<div class="post-metadata">

### Author: ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)
#### Post date: [November 16, 2023, 12:34pm UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/6 "2023-11-16T12:34:56Z")

</div>

> [@roh\_codeur](#):
>
> ```
> volumes:
> - ./deploy/uat/Olorin:/data/code/Olorin
> 
> ```
> 
> …
> 
> `aarch64`

This is Docker Desktop + macOS + Apple M Silicon?

There is a known problem with `VirtioFS` + PostgreSQL directory :

- [virtiofs breaks initial startup of Postgres container · Issue #6270 · docker/for-mac · GitHub](https://github.com/docker/for-mac/issues/6270)

Please:

- Share all the details about the runtime environment.
- Temporarily try to modify the Dockerfile so that it downloads the test code using git clone. This is to filter out any potential issues between the filesystem and Docker.
- Try on other Linux machine.

---

<div class="post-metadata">

### Author: ![roh\_codeur](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@roh\_codeur](https://discourse.julialang.org/u/roh_codeur)
#### Post date: [November 18, 2023, 9:45am UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/7 "2023-11-18T09:45:51Z")

</div>

> [@ImreSamu](#):
>
> This is Docker Desktop + macOS + Apple M Silicon?

This is indeed! however, the issue is as @HanD described.

---

<div class="post-metadata">

### Author: ![roh\_codeur](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@roh\_codeur](https://discourse.julialang.org/u/roh_codeur)
#### Post date: [November 18, 2023, 9:49am UTC](https://discourse.julialang.org/t/pkg-not-sure-whats-going-on/106071/8 "2023-11-18T09:49:23Z")

</div>

@HanD : thanks a lot for the response and suggestions. you were absolutely right, the issue is indeed as you described and the resolution worked like a charm.

for everyone else, the below works:

DockerFile:

> # Use a base image with a Linux distribution
> 
> FROM ubuntu:latest
> 
> SHELL [“/bin/bash”, “-c”]
> 
> COPY install/docker-entrypoint.sh /data/deploy/
> 
> RUN apt-get update &&   
> apt-get install -y wget &&   
> apt-get install unzip  
> RUN apt-get update && apt-get -y install libgconf-2-4  
> RUN apt --fix-broken install  
> RUN echo “\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* INSTALLING MINICONDA \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*”  
> WORKDIR /apps/third-party
> 
> ENV PATH=“/apps/third-party/miniconda3/bin:{PATH}" ARG PATH="/apps/third-party/miniconda3/bin:{PATH}”  
> RUN wget [https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh](https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh)   
> && bash Miniconda3-latest-Linux-aarch64.sh -b -u -p miniconda3   
> && rm Miniconda3-latest-Linux-aarch64.sh   
> && miniconda3/bin/conda init bash   
> && source /root/.bashrc  
> RUN conda --version  
> RUN mkdir -p /data/deploy  
> COPY install/requirements.txt /data/deploy/  
> RUN pip install -r /data/deploy/requirements.txt  
> RUN echo “\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* DONE INSTALLING MINICONDA \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*”
> 
> RUN echo “\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* INSTALLING JULIA \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*”  
> WORKDIR /apps/third-party  
> RUN wget [https://julialang-s3.julialang.org/bin/linux/aarch64/1.9/julia-1.9.3-linux-aarch64.tar.gz](https://julialang-s3.julialang.org/bin/linux/aarch64/1.9/julia-1.9.3-linux-aarch64.tar.gz) &&   
> tar -xvf julia-1.9.3-linux-aarch64.tar.gz &&   
> rm julia-1.9.3-linux-aarch64.tar.gz
> 
> RUN mkdir -p /root/.julia/config  
> COPY install/startup.jl /root/.julia/config/  
> ENV PATH=$PATH:/apps/third-party/julia-1.9.3/bin/
> 
> # Install Julia project dependencies and activate the environment
> 
> WORKDIR /data/code/Olorin/  
> ARG CURRENT\_ENV  
> RUN echo “Activating environment: $CURRENT\_ENV”  
> COPY deploy/$CURRENT\_ENV/Olorin/Manifest.toml /data/code/Olorin/  
> COPY deploy/$CURRENT\_ENV/Olorin/Project.toml /data/code/Olorin/  
> RUN julia -e ‘using Pkg; Pkg.instantiate()’  
> RUN julia -e ‘ENV[“PYTHON”] = “/apps/third-party/miniconda3/bin/python”; using Pkg; Pkg.build(“PyCall”)’  
> RUN julia -e “using Pkg; Pkg.status()”  
> RUN julia -e ‘ENV[“PYTHON”] = “/apps/third-party/miniconda3/bin/python”; using Pkg; Pkg.build(“PyCall”)’  
> RUN echo “\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* DONE INSTALLING JULIA \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*”
> 
> ENTRYPOINT [“sh”,“/data/deploy/docker-entrypoint.sh”]

DockerFile

> services:  
> workspace:  
> build:  
> context: .  
> args:  
> - CURRENT\_ENV=uat  
> container\_name: uat  
> volumes:  
> - ./deploy/uat/Olorin:/data/code/Olorin  
> command: /data/deploy/docker-entrypoint.sh
