imx-docker: bash command not found

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx-docker: bash command not found

437 Views
AlanWen
Contributor III

Hi, I am trying to build the imx bsp from docker container. I follow the github nxp-imx/imx-docker repo to build the docker image & its container.

nxp-imx/imx-docker: i.MX Docker (github.com)

After running up the container and it caused some failures in bitbake, so I tried to attach the container to fix it. But the container can't run any bash command when I attach to it as shown below.

user@0882fd94a700:~/Downloads/nxp/imx_docker$ ls
bash: ls: command not found
user@0882fd94a700:~/Downloads/nxp/imx_docker$ bitbake
bash: bitbake: command not found

 

If I build the base image as ubuntu:20.04 and run a container like

docker run -it --name ubuntu2004 ubuntu:20.04 /bin/bash

 and it can use bash command.

Sample of the Dockerfile-Ubuntu20.04

FROM ubuntu:20.04

# Update system and add the packages required for Yocto builds.
# Use DEBIAN_FRONTEND=noninteractive, to avoid image build hang waiting
# for a default confirmation [Y/n] at some configurations.

ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y gawk wget git-core diffstat unzip texinfo \
    gcc-multilib build-essential chrpath socat cpio python python3 \
    python3-pip python3-pexpect xz-utils debianutils iputils-ping \
    libsdl1.2-dev xterm tar locales net-tools rsync sudo vim curl zstd \
    liblz4-tool libssl-dev bc lzop

# Set up locales
RUN locale-gen en_US.UTF-8 && \
    update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8

# Yocto needs 'source' command for setting up the build environment, so replace
# the 'sh' alias to 'bash' instead of 'dash'.
RUN rm /bin/sh && ln -s bash /bin/sh

# Install repo
ADD https://storage.googleapis.com/git-repo-downloads/repo /usr/local/bin/
RUN chmod 755 /usr/local/bin/repo

# Add your user to sudoers to be able to install other packages in the container.
ARG USER
RUN echo "${USER} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER} && \
    chmod 0440 /etc/sudoers.d/${USER}

# Set the arguments for host_id and user_id to be able to save the build artifacts
# outside the container, on host directories, as docker volumes.
ARG host_uid \
    host_gid
RUN groupadd -g $host_gid nxp && \
    useradd -g $host_gid -m -s /bin/bash -u $host_uid $USER

# Yocto builds should run as a normal user.
USER $USER

ARG DOCKER_WORKDIR
WORKDIR ${DOCKER_WORKDIR}

 

I don't know what made the docker container can not use the bash command in the Dockerfile. Can some one help me figure this out ?

Tags (3)
0 Kudos
Reply
2 Replies

404 Views
AlanWen
Contributor III

But with the script docker-run.sh and attached the container, the bash command failed. Now I figure the problem may be the docker volume arguments and bash command that something had conflict in docker-run.sh

 

docker run -it --rm \
    --volume ${HOME}:${HOME} \
    --volume ${DOCKER_WORKDIR}:${DOCKER_WORKDIR} \
    --volume $(pwd)/${IMX_RELEASE}:${DOCKER_WORKDIR}/${IMX_RELEASE} \
    "${DOCKER_IMAGE_TAG}" \
    $1

 

 If I replaced the $1 to /bin/bash and it would cause the command not found problem.

0 Kudos
Reply

421 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi
If I build the base image as ubuntu:20.04 and run a container like,and it can use bash command.

-->This is correct step, you can only use bash command after you run it.


Best Regards
Zhiming

0 Kudos
Reply