Unable to change present directory [or "cd" cmd ignored]

circleci is ignoring “cd” cmd or giving error which leads to build fail in docker-compose build .

3 Likes

You could argue whether this is a feature or an anti-feature, but it’s not a bug. basically, each separate command is starting over in a new process, so if you want to change directory and then execute a command, then you would put it into the same line with &&, e.g.: cd /home/ubuntu/honoriety/docker && pwd.

If you want to be in the same directory for a subsequent command, you would cd again, or put all the things you want to do into a shell script file and make a command that just runs that script.

2 Likes

You can also do multi-line YAML to include multiple lines in the same “command” in circle.yml.

thanks @btmorr that worked :slight_smile: !!