简体   繁体   中英

launch basic bash script on docker build from windows system

I would like to construct a docker image based from script bash for provisioning my system.

I try to build my image and docker tell me "Successfully built" but when I try to launch this I can see this message : "No such file or directory" and I can't viewing container in Kitematic application.

If I launch docker inspect on my container (created correctly but not launched) I can view a ExitCode 127 .

Can you help me to understand issue and also help me to launch correctly a simple script bash for provisionning image docker.

dockerfile :

FROM ubuntu:trusty
MAINTAINER barbie rambo <barbierambo@mymail.com>

RUN apt-get update \
    && apt-get install -y openjdk-7-jdk wget openssh-server tar vim

COPY scripts/base.sh /home/docker/scripts/base.sh
RUN chmod 744 /home/docker/scripts/base.sh
ENTRYPOINT /home/docker/scripts/base.sh

my base.sh script

#!/usr/bin/env bash

# Set non-interactive mode
#export DEBIAN_FRONTEND=noninteractive

# Update the box
apt-get -y update
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
apt-get -y install curl unzip
apt-get -y install software-properties-common
apt-get -y install gnupg2

# others tools
sudo apt-get -y install nano
sudo apt-get -y install vim
sudo apt-get -y install aptitude
sudo apt-get -y install git
sudo apt-get -y install openjdk-8-jre
sudo apt-get -y install whois
sudo apt-get -y install dos2unix

check whether /home/docker/scripts/base.sh has EOL as UNIX/OSX Format, if not you can do EOL Conversion in Notepad++

  • open file in Notepad++ -> Edit -> EOL Conversion -> UNIX/OSX Format -> Save

  • then rebuild docker image

If you want to get into container ten run following:

docker ps -a

and use container id docker exec -i -t [containerID] bash

and check whether file /home/docker/scripts/base.sh exists

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM